1 ; RUN: llc < %s --mtriple=wasm32-unknown-unknown -mattr=+atomics,+sign-ext -asm-verbose=false -wasm-disable-explicit-locals -wasm-keep-registers | FileCheck %s
2 ; RUN: llc < %s --mtriple=wasm64-unknown-unknown -mattr=+atomics,+sign-ext -asm-verbose=false -wasm-disable-explicit-locals -wasm-keep-registers | FileCheck %s
4 ; Test that truncating stores are assembled properly.
6 ; CHECK-LABEL: trunc_i8_i32:
7 ; CHECK: i32.atomic.store8 0($0), $1{{$}}
8 define void @trunc_i8_i32(ptr %p, i32 %v) {
9 %t = trunc i32 %v to i8
10 store atomic i8 %t, ptr %p seq_cst, align 1
14 ; CHECK-LABEL: trunc_i16_i32:
15 ; CHECK: i32.atomic.store16 0($0), $1{{$}}
16 define void @trunc_i16_i32(ptr %p, i32 %v) {
17 %t = trunc i32 %v to i16
18 store atomic i16 %t, ptr %p seq_cst, align 2
22 ; CHECK-LABEL: trunc_i8_i64:
23 ; CHECK: i64.atomic.store8 0($0), $1{{$}}
24 define void @trunc_i8_i64(ptr %p, i64 %v) {
25 %t = trunc i64 %v to i8
26 store atomic i8 %t, ptr %p seq_cst, align 1
30 ; CHECK-LABEL: trunc_i16_i64:
31 ; CHECK: i64.atomic.store16 0($0), $1{{$}}
32 define void @trunc_i16_i64(ptr %p, i64 %v) {
33 %t = trunc i64 %v to i16
34 store atomic i16 %t, ptr %p seq_cst, align 2
38 ; CHECK-LABEL: trunc_i32_i64:
39 ; CHECK: i64.atomic.store32 0($0), $1{{$}}
40 define void @trunc_i32_i64(ptr %p, i64 %v) {
41 %t = trunc i64 %v to i32
42 store atomic i32 %t, ptr %p seq_cst, align 4