1 # RUN: llc -mtriple arm-- -run-pass=legalizer %s -o - | FileCheck %s
2 # RUN: llc -mtriple thumb-- -mattr=+v6t2 -run-pass=legalizer %s -o - | FileCheck %s
4 define void @test_select_s32() { ret void }
5 define void @test_select_ptr() { ret void }
7 define void @test_select_s16() { ret void }
8 define void @test_select_s8() { ret void }
12 # CHECK-LABEL: name: test_select_s32
14 # CHECK: legalized: true
15 regBankSelected: false
17 tracksRegLiveness: true
25 liveins: $r0, $r1, $r2
29 %2(s1) = G_CONSTANT i1 1
30 %3(s32) = G_SELECT %2(s1), %0, %1
31 ; G_SELECT with s32 is legal, so we should find it unchanged in the output
32 ; CHECK: {{%[0-9]+}}:_(s32) = G_SELECT {{%[0-9]+}}(s1), {{%[0-9]+}}, {{%[0-9]+}}
34 BX_RET 14, $noreg, implicit $r0
38 # CHECK-LABEL: name: test_select_ptr
40 # CHECK: legalized: true
41 regBankSelected: false
43 tracksRegLiveness: true
51 liveins: $r0, $r1, $r2
55 %2(s1) = G_CONSTANT i1 0
56 %3(p0) = G_SELECT %2(s1), %0, %1
57 ; G_SELECT with p0 is legal, so we should find it unchanged in the output
58 ; CHECK: {{%[0-9]+}}:_(p0) = G_SELECT {{%[0-9]+}}(s1), {{%[0-9]+}}, {{%[0-9]+}}
60 BX_RET 14, $noreg, implicit $r0
64 # CHECK-LABEL: name: test_select_s16
66 # CHECK: legalized: true
67 regBankSelected: false
69 tracksRegLiveness: true
80 liveins: $r0, $r1, $r2
83 %1(s16) = G_TRUNC %0(s32)
85 %3(s16) = G_TRUNC %2(s32)
86 %4(s1) = G_CONSTANT i1 1
87 %5(s16) = G_SELECT %4(s1), %1, %3
88 ; G_SELECT with s16 should extend
89 ; CHECK-NOT: {{%[0-9]+}}:_(s16) = G_SELECT {{%[0-9]+}}(s1), {{%[0-9]+}}, {{%[0-9]+}}
90 ; CHECK: {{%[0-9]+}}:_(s32) = G_SELECT {{%[0-9]+}}(s1), {{%[0-9]+}}, {{%[0-9]+}}
91 ; CHECK-NOT: {{%[0-9]+}}:_(s16) = G_SELECT {{%[0-9]+}}(s1), {{%[0-9]+}}, {{%[0-9]+}}
92 %6(s32) = G_SEXT %5(s16)
94 BX_RET 14, $noreg, implicit $r0
98 # CHECK-LABEL: name: test_select_s8
100 # CHECK: legalized: true
101 regBankSelected: false
103 tracksRegLiveness: true
105 - { id: 0, class: _ }
106 - { id: 1, class: _ }
107 - { id: 2, class: _ }
108 - { id: 3, class: _ }
109 - { id: 4, class: _ }
110 - { id: 5, class: _ }
111 - { id: 6, class: _ }
114 liveins: $r0, $r1, $r2
117 %1(s8) = G_TRUNC %0(s32)
119 %3(s8) = G_TRUNC %2(s32)
120 %4(s1) = G_CONSTANT i1 1
121 %5(s8) = G_SELECT %4(s1), %1, %3
122 ; G_SELECT with s8 should extend
123 ; CHECK-NOT: {{%[0-9]+}}:_(s8) = G_SELECT {{%[0-9]+}}(s1), {{%[0-9]+}}, {{%[0-9]+}}
124 ; CHECK: {{%[0-9]+}}:_(s32) = G_SELECT {{%[0-9]+}}(s1), {{%[0-9]+}}, {{%[0-9]+}}
125 ; CHECK-NOT: {{%[0-9]+}}:_(s8) = G_SELECT {{%[0-9]+}}(s1), {{%[0-9]+}}, {{%[0-9]+}}
126 %6(s32) = G_SEXT %5(s8)
128 BX_RET 14, $noreg, implicit $r0