1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=fiji -run-pass=legalizer -global-isel %s -o - | FileCheck %s
5 name: test_sitofp_s32_to_s32
10 ; CHECK-LABEL: name: test_sitofp_s32_to_s32
11 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
12 ; CHECK: [[SITOFP:%[0-9]+]]:_(s32) = G_SITOFP [[COPY]](s32)
13 ; CHECK: $vgpr0 = COPY [[SITOFP]](s32)
14 %0:_(s32) = COPY $vgpr0
15 %1:_(s32) = G_SITOFP %0
20 name: test_sitofp_s32_to_s64
25 ; CHECK-LABEL: name: test_sitofp_s32_to_s64
26 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
27 ; CHECK: [[SITOFP:%[0-9]+]]:_(s64) = G_SITOFP [[COPY]](s32)
28 ; CHECK: $vgpr0_vgpr1 = COPY [[SITOFP]](s64)
29 %0:_(s32) = COPY $vgpr0
30 %1:_(s64) = G_SITOFP %0
31 $vgpr0_vgpr1 = COPY %1
35 name: test_sitofp_v2s32_to_v2s32
40 ; CHECK-LABEL: name: test_sitofp_v2s32_to_v2s32
41 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr0_vgpr1
42 ; CHECK: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](<2 x s32>)
43 ; CHECK: [[SITOFP:%[0-9]+]]:_(s32) = G_SITOFP [[UV]](s32)
44 ; CHECK: [[SITOFP1:%[0-9]+]]:_(s32) = G_SITOFP [[UV1]](s32)
45 ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[SITOFP]](s32), [[SITOFP1]](s32)
46 ; CHECK: $vgpr0_vgpr1 = COPY [[BUILD_VECTOR]](<2 x s32>)
47 %0:_(<2 x s32>) = COPY $vgpr0_vgpr1
48 %1:_(<2 x s32>) = G_SITOFP %0
49 $vgpr0_vgpr1 = COPY %1
53 name: test_sitofp_v2s32_to_v2s64
58 ; CHECK-LABEL: name: test_sitofp_v2s32_to_v2s64
59 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr0_vgpr1
60 ; CHECK: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](<2 x s32>)
61 ; CHECK: [[SITOFP:%[0-9]+]]:_(s64) = G_SITOFP [[UV]](s32)
62 ; CHECK: [[SITOFP1:%[0-9]+]]:_(s64) = G_SITOFP [[UV1]](s32)
63 ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s64>) = G_BUILD_VECTOR [[SITOFP]](s64), [[SITOFP1]](s64)
64 ; CHECK: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[BUILD_VECTOR]](<2 x s64>)
65 %0:_(<2 x s32>) = COPY $vgpr0_vgpr1
66 %1:_(<2 x s64>) = G_SITOFP %0
67 $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %1
71 name: test_sitofp_s64_to_s32
76 ; CHECK-LABEL: name: test_sitofp_s64_to_s32
77 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
78 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 63
79 ; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[C]](s64)
80 ; CHECK: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[COPY]], [[TRUNC]](s32)
81 ; CHECK: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](s64)
82 ; CHECK: [[UV2:%[0-9]+]]:_(s32), [[UV3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[ASHR]](s64)
83 ; CHECK: [[UADDO:%[0-9]+]]:_(s32), [[UADDO1:%[0-9]+]]:_(s1) = G_UADDO [[UV]], [[UV2]]
84 ; CHECK: [[UADDE:%[0-9]+]]:_(s32), [[UADDE1:%[0-9]+]]:_(s1) = G_UADDE [[UV1]], [[UV3]], [[UADDO1]]
85 ; CHECK: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[UADDO]](s32), [[UADDE]](s32)
86 ; CHECK: [[XOR:%[0-9]+]]:_(s64) = G_XOR [[MV]], [[ASHR]]
87 ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
88 ; CHECK: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
89 ; CHECK: [[CTLZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTLZ_ZERO_UNDEF [[XOR]](s64)
90 ; CHECK: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 190
91 ; CHECK: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[C3]], [[CTLZ_ZERO_UNDEF]]
92 ; CHECK: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[XOR]](s64), [[C2]]
93 ; CHECK: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s1), [[SUB]], [[C1]]
94 ; CHECK: [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 9223372036854775807
95 ; CHECK: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[XOR]], [[CTLZ_ZERO_UNDEF]](s32)
96 ; CHECK: [[AND:%[0-9]+]]:_(s64) = G_AND [[SHL]], [[C4]]
97 ; CHECK: [[C5:%[0-9]+]]:_(s64) = G_CONSTANT i64 1099511627775
98 ; CHECK: [[AND1:%[0-9]+]]:_(s64) = G_AND [[AND]], [[C5]]
99 ; CHECK: [[C6:%[0-9]+]]:_(s64) = G_CONSTANT i64 40
100 ; CHECK: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[C6]](s64)
101 ; CHECK: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[AND]], [[TRUNC1]](s32)
102 ; CHECK: [[C7:%[0-9]+]]:_(s32) = G_CONSTANT i32 23
103 ; CHECK: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[SELECT]], [[C7]](s32)
104 ; CHECK: [[TRUNC2:%[0-9]+]]:_(s32) = G_TRUNC [[LSHR]](s64)
105 ; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR [[SHL1]], [[TRUNC2]]
106 ; CHECK: [[C8:%[0-9]+]]:_(s64) = G_CONSTANT i64 549755813888
107 ; CHECK: [[ICMP1:%[0-9]+]]:_(s1) = G_ICMP intpred(ugt), [[AND1]](s64), [[C8]]
108 ; CHECK: [[ICMP2:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[AND1]](s64), [[C8]]
109 ; CHECK: [[C9:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
110 ; CHECK: [[AND2:%[0-9]+]]:_(s32) = G_AND [[OR]], [[C9]]
111 ; CHECK: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[ICMP2]](s1), [[AND2]], [[C1]]
112 ; CHECK: [[SELECT2:%[0-9]+]]:_(s32) = G_SELECT [[ICMP1]](s1), [[C9]], [[SELECT1]]
113 ; CHECK: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[OR]], [[SELECT2]]
114 ; CHECK: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[XOR]](s64)
115 ; CHECK: [[FNEG:%[0-9]+]]:_(s32) = G_FNEG [[UITOFP]]
116 ; CHECK: [[ICMP3:%[0-9]+]]:_(s1) = G_ICMP intpred(ne), [[ASHR]](s64), [[C2]]
117 ; CHECK: [[SELECT3:%[0-9]+]]:_(s32) = G_SELECT [[ICMP3]](s1), [[FNEG]], [[UITOFP]]
118 ; CHECK: [[SITOFP:%[0-9]+]]:_(s32) = G_SITOFP [[COPY]](s64)
119 ; CHECK: $vgpr0 = COPY [[SITOFP]](s32)
120 %0:_(s64) = COPY $vgpr0_vgpr1
121 %1:_(s32) = G_SITOFP %0
126 name: test_sitofp_s64_to_s64
129 liveins: $vgpr0_vgpr1
131 ; CHECK-LABEL: name: test_sitofp_s64_to_s64
132 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
133 ; CHECK: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](s64)
134 ; CHECK: [[SITOFP:%[0-9]+]]:_(s64) = G_SITOFP [[UV1]](s32)
135 ; CHECK: [[UITOFP:%[0-9]+]]:_(s64) = G_UITOFP [[UV]](s32)
136 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 32
137 ; CHECK: [[INT:%[0-9]+]]:_(s64) = G_INTRINSIC intrinsic(@llvm.amdgcn.ldexp), [[SITOFP]](s64), [[C]](s32)
138 ; CHECK: [[FADD:%[0-9]+]]:_(s64) = G_FADD [[INT]], [[UITOFP]]
139 ; CHECK: $vgpr0_vgpr1 = COPY [[FADD]](s64)
140 %0:_(s64) = COPY $vgpr0_vgpr1
141 %1:_(s64) = G_SITOFP %0
142 $vgpr0_vgpr1 = COPY %1