2018-08-27 23:45:51 +08:00
|
|
|
; RUN: llc < %s -asm-verbose=false -wasm-disable-explicit-locals -wasm-keep-registers | FileCheck %s
|
2015-09-01 06:24:11 +08:00
|
|
|
|
|
|
|
; 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"
|
2018-05-11 01:49:11 +08:00
|
|
|
target triple = "wasm32-unknown-unknown"
|
2015-09-01 06:24:11 +08:00
|
|
|
|
2015-10-06 08:27:55 +08:00
|
|
|
; CHECK-LABEL: trunc_i8_i32:
|
2016-10-07 06:08:28 +08:00
|
|
|
; CHECK: i32.store8 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-10-07 06:08:28 +08:00
|
|
|
; CHECK: i32.store16 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-10-07 06:08:28 +08:00
|
|
|
; CHECK: i64.store8 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-10-07 06:08:28 +08:00
|
|
|
; CHECK: i64.store16 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-10-07 06:08:28 +08:00
|
|
|
; CHECK: i64.store32 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
|
|
|
|
}
|