WebAssembly: update syntax
[oota-llvm.git] / test / CodeGen / WebAssembly / store-trunc.ll
1 ; RUN: llc < %s -asm-verbose=false | FileCheck %s
2
3 ; Test that truncating stores are assembled properly.
4
5 target datalayout = "e-p:32:32-i64:64-n32:64-S128"
6 target triple = "wasm32-unknown-unknown"
7
8 ; CHECK-LABEL: trunc_i8_i32:
9 ; CHECK: store_i8 (get_local 3), (get_local 2){{$}}
10 define void @trunc_i8_i32(i8 *%p, i32 %v) {
11   %t = trunc i32 %v to i8
12   store i8 %t, i8* %p
13   ret void
14 }
15
16 ; CHECK-LABEL: trunc_i16_i32:
17 ; CHECK: store_i16 (get_local 3), (get_local 2){{$}}
18 define void @trunc_i16_i32(i16 *%p, i32 %v) {
19   %t = trunc i32 %v to i16
20   store i16 %t, i16* %p
21   ret void
22 }
23
24 ; CHECK-LABEL: trunc_i8_i64:
25 ; CHECK: store_i8 (get_local 3), (get_local 2){{$}}
26 define void @trunc_i8_i64(i8 *%p, i64 %v) {
27   %t = trunc i64 %v to i8
28   store i8 %t, i8* %p
29   ret void
30 }
31
32 ; CHECK-LABEL: trunc_i16_i64:
33 ; CHECK: store_i16 (get_local 3), (get_local 2){{$}}
34 define void @trunc_i16_i64(i16 *%p, i64 %v) {
35   %t = trunc i64 %v to i16
36   store i16 %t, i16* %p
37   ret void
38 }
39
40 ; CHECK-LABEL: trunc_i32_i64:
41 ; CHECK: store_i32 (get_local 3), (get_local 2){{$}}
42 define void @trunc_i32_i64(i32 *%p, i64 %v) {
43   %t = trunc i64 %v to i32
44   store i32 %t, i32* %p
45   ret void
46 }