2015-09-01 06:24:11 +08:00
|
|
|
; RUN: llc < %s -asm-verbose=false | FileCheck %s
|
|
|
|
|
|
|
|
; Test that truncating stores are assembled properly.
|
|
|
|
|
2016-01-07 11:19:23 +08:00
|
|
|
target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
|
2015-09-01 06:24:11 +08:00
|
|
|
target triple = "wasm32-unknown-unknown"
|
|
|
|
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-LABEL: trunc_i8_i32:
|
2016-05-18 07:19:03 +08:00
|
|
|
; CHECK: i32.store8 $drop=, 0($0), $1{{$}}
|
2015-09-01 06:24:11 +08:00
|
|
|
define void @trunc_i8_i32(i8 *%p, i32 %v) {
|
|
|
|
%t = trunc i32 %v to i8
|
|
|
|
store i8 %t, i8* %p
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-LABEL: trunc_i16_i32:
|
2016-05-18 07:19:03 +08:00
|
|
|
; CHECK: i32.store16 $drop=, 0($0), $1{{$}}
|
2015-09-01 06:24:11 +08:00
|
|
|
define void @trunc_i16_i32(i16 *%p, i32 %v) {
|
|
|
|
%t = trunc i32 %v to i16
|
|
|
|
store i16 %t, i16* %p
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-LABEL: trunc_i8_i64:
|
2016-05-18 07:19:03 +08:00
|
|
|
; CHECK: i64.store8 $drop=, 0($0), $1{{$}}
|
2015-09-01 06:24:11 +08:00
|
|
|
define void @trunc_i8_i64(i8 *%p, i64 %v) {
|
|
|
|
%t = trunc i64 %v to i8
|
|
|
|
store i8 %t, i8* %p
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-LABEL: trunc_i16_i64:
|
2016-05-18 07:19:03 +08:00
|
|
|
; CHECK: i64.store16 $drop=, 0($0), $1{{$}}
|
2015-09-01 06:24:11 +08:00
|
|
|
define void @trunc_i16_i64(i16 *%p, i64 %v) {
|
|
|
|
%t = trunc i64 %v to i16
|
|
|
|
store i16 %t, i16* %p
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-LABEL: trunc_i32_i64:
|
2016-05-18 07:19:03 +08:00
|
|
|
; CHECK: i64.store32 $drop=, 0($0), $1{{$}}
|
2015-09-01 06:24:11 +08:00
|
|
|
define void @trunc_i32_i64(i32 *%p, i64 %v) {
|
|
|
|
%t = trunc i64 %v to i32
|
|
|
|
store i32 %t, i32* %p
|
|
|
|
ret void
|
|
|
|
}
|