1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=aarch64-- -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s
4 define void @truncating_f32(double %x) {
5 %alloca = alloca i32, align 4
6 %bitcast = bitcast double %x to i64
7 %trunc = trunc i64 %bitcast to i32
8 store i32 %trunc, i32* %alloca, align 4
12 define void @truncating_f16(double %x) {
13 %alloca = alloca i16, align 2
14 %bitcast = bitcast double %x to i64
15 %trunc = trunc i64 %bitcast to i16
16 store i16 %trunc, i16* %alloca, align 2
20 define void @truncating_f8(double %x) {
21 %alloca = alloca i8, align 1
22 %bitcast = bitcast double %x to i64
23 %trunc = trunc i64 %bitcast to i8
24 store i8 %trunc, i8* %alloca, align 1
34 tracksRegLiveness: true
40 - { id: 0, name: alloca, size: 4, alignment: 4 }
41 machineFunctionInfo: {}
46 ; CHECK-LABEL: name: truncating_f32
48 ; CHECK: [[COPY:%[0-9]+]]:fpr64 = COPY $d0
49 ; CHECK: [[COPY1:%[0-9]+]]:fpr32 = COPY [[COPY]].ssub
50 ; CHECK: STRSui [[COPY1]], %stack.0.alloca, 0 :: (store (s32) into %ir.alloca)
52 %0:fpr(s64) = COPY $d0
53 %1:gpr(p0) = G_FRAME_INDEX %stack.0.alloca
54 G_STORE %0(s64), %1(p0) :: (store (s32) into %ir.alloca)
63 tracksRegLiveness: true
69 - { id: 0, name: alloca, size: 2, alignment: 2 }
70 machineFunctionInfo: {}
75 ; CHECK-LABEL: name: truncating_f16
77 ; CHECK: [[COPY:%[0-9]+]]:fpr64 = COPY $d0
78 ; CHECK: [[COPY1:%[0-9]+]]:fpr16 = COPY [[COPY]].hsub
79 ; CHECK: STRHui [[COPY1]], %stack.0.alloca, 0 :: (store (s16) into %ir.alloca)
81 %0:fpr(s64) = COPY $d0
82 %1:gpr(p0) = G_FRAME_INDEX %stack.0.alloca
83 G_STORE %0(s64), %1(p0) :: (store (s16) into %ir.alloca)
92 tracksRegLiveness: true
98 - { id: 0, name: alloca, size: 1, alignment: 1 }
99 machineFunctionInfo: {}
104 ; CHECK-LABEL: name: truncating_f8
105 ; CHECK: liveins: $d0
106 ; CHECK: [[COPY:%[0-9]+]]:fpr64 = COPY $d0
107 ; CHECK: [[COPY1:%[0-9]+]]:fpr8 = COPY [[COPY]].bsub
108 ; CHECK: STRBui [[COPY1]], %stack.0.alloca, 0 :: (store (s8) into %ir.alloca)
109 ; CHECK: RET_ReallyLR
110 %0:fpr(s64) = COPY $d0
111 %1:gpr(p0) = G_FRAME_INDEX %stack.0.alloca
112 G_STORE %0(s64), %1(p0) :: (store (s8) into %ir.alloca)