1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -o - -mtriple=aarch64-unknown-unknown -run-pass=aarch64-prelegalizer-combiner -verify-machineinstrs %s | FileCheck %s
4 name: test_combine_trunc_undef
7 ; CHECK-LABEL: name: test_combine_trunc_undef
8 ; CHECK: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
9 ; CHECK: $w0 = COPY [[DEF]](s32)
10 %0:_(s64) = G_IMPLICIT_DEF
11 %1:_(s32) = G_TRUNC %0(s64)
15 name: test_combine_trunc_undef_vec
18 ; CHECK-LABEL: name: test_combine_trunc_undef_vec
19 ; CHECK: [[DEF:%[0-9]+]]:_(<2 x s32>) = G_IMPLICIT_DEF
20 ; CHECK: $x0 = COPY [[DEF]](<2 x s32>)
21 %0:_(<2 x s64>) = G_IMPLICIT_DEF
22 %1:_(<2 x s32>) = G_TRUNC %0(<2 x s64>)
23 $x0 = COPY %1(<2 x s32>)
26 name: test_combine_trunc_anyext_s32_s16
30 ; CHECK-LABEL: name: test_combine_trunc_anyext_s32_s16
31 ; CHECK: [[COPY:%[0-9]+]]:_(s16) = COPY $h0
32 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[COPY]](s16)
33 ; CHECK: $w0 = COPY [[ANYEXT]](s32)
35 %1:_(s64) = G_ANYEXT %0(s16)
36 %2:_(s32) = G_TRUNC %1(s64)
40 name: test_combine_trunc_anyext_s32_s16_vec
44 ; CHECK-LABEL: name: test_combine_trunc_anyext_s32_s16_vec
45 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s16>) = COPY $s0
46 ; CHECK: [[ANYEXT:%[0-9]+]]:_(<2 x s32>) = G_ANYEXT [[COPY]](<2 x s16>)
47 ; CHECK: $x0 = COPY [[ANYEXT]](<2 x s32>)
48 %0:_(<2 x s16>) = COPY $s0
49 %1:_(<2 x s64>) = G_ANYEXT %0(<2 x s16>)
50 %2:_(<2 x s32>) = G_TRUNC %1(<2 x s64>)
51 $x0 = COPY %2(<2 x s32>)
54 name: test_combine_trunc_sext_s32_s16
58 ; CHECK-LABEL: name: test_combine_trunc_sext_s32_s16
59 ; CHECK: [[COPY:%[0-9]+]]:_(s16) = COPY $h0
60 ; CHECK: [[SEXT:%[0-9]+]]:_(s32) = G_SEXT [[COPY]](s16)
61 ; CHECK: $w0 = COPY [[SEXT]](s32)
63 %1:_(s64) = G_SEXT %0(s16)
64 %2:_(s32) = G_TRUNC %1(s64)
68 name: test_combine_trunc_zext_s32_s16
72 ; CHECK-LABEL: name: test_combine_trunc_zext_s32_s16
73 ; CHECK: [[COPY:%[0-9]+]]:_(s16) = COPY $h0
74 ; CHECK: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[COPY]](s16)
75 ; CHECK: $w0 = COPY [[ZEXT]](s32)
77 %1:_(s64) = G_ZEXT %0(s16)
78 %2:_(s32) = G_TRUNC %1(s64)
82 name: test_combine_trunc_anyext_s32_s32
86 ; CHECK-LABEL: name: test_combine_trunc_anyext_s32_s32
87 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
88 ; CHECK: $w0 = COPY [[COPY]](s32)
90 %1:_(s64) = G_ANYEXT %0(s32)
91 %2:_(s32) = G_TRUNC %1(s64)
95 name: test_combine_trunc_anyext_s32_s64
99 ; CHECK-LABEL: name: test_combine_trunc_anyext_s32_s64
100 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
101 ; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
102 ; CHECK: $w0 = COPY [[TRUNC]](s32)
104 %1:_(s128) = G_ANYEXT %0(s64)
105 %2:_(s32) = G_TRUNC %1(s128)
109 name: test_combine_trunc_shl_s32_by_2
113 ; CHECK-LABEL: name: test_combine_trunc_shl_s32_by_2
114 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
115 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 2
116 ; CHECK: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
117 ; CHECK: [[SHL:%[0-9]+]]:_(s16) = G_SHL [[TRUNC]], [[C]](s32)
118 ; CHECK: $h0 = COPY [[SHL]](s16)
120 %1:_(s32) = G_CONSTANT i32 2
121 %2:_(s32) = G_SHL %0(s32), %1(s32)
122 %3:_(s16) = G_TRUNC %2(s32)
126 name: test_combine_trunc_shl_s32_by_17
130 ; CHECK-LABEL: name: test_combine_trunc_shl_s32_by_17
131 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
132 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 17
133 ; CHECK: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[C]](s32)
134 ; CHECK: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[SHL]](s32)
135 ; CHECK: $h0 = COPY [[TRUNC]](s16)
137 %1:_(s32) = G_CONSTANT i32 17
138 %2:_(s32) = G_SHL %0(s32), %1(s32)
139 %3:_(s16) = G_TRUNC %2(s32)