• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3--- |
4  define void @test_select_s32() { ret void }
5  define void @test_select_ptr() { ret void }
6
7  define void @test_select_s16() { ret void }
8  define void @test_select_s8() { ret void }
9...
10---
11name:            test_select_s32
12# CHECK-LABEL: name: test_select_s32
13legalized:       false
14# CHECK: legalized: true
15regBankSelected: false
16selected:        false
17tracksRegLiveness: true
18registers:
19  - { id: 0, class: _ }
20  - { id: 1, class: _ }
21  - { id: 2, class: _ }
22  - { id: 3, class: _ }
23body:             |
24  bb.0:
25    liveins: $r0, $r1, $r2
26
27    %0(s32) = COPY $r0
28    %1(s32) = COPY $r1
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]+}}
33    $r0 = COPY %3(s32)
34    BX_RET 14, $noreg, implicit $r0
35...
36---
37name:            test_select_ptr
38# CHECK-LABEL: name: test_select_ptr
39legalized:       false
40# CHECK: legalized: true
41regBankSelected: false
42selected:        false
43tracksRegLiveness: true
44registers:
45  - { id: 0, class: _ }
46  - { id: 1, class: _ }
47  - { id: 2, class: _ }
48  - { id: 3, class: _ }
49body:             |
50  bb.0:
51    liveins: $r0, $r1, $r2
52
53    %0(p0) = COPY $r0
54    %1(p0) = COPY $r1
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]+}}
59    $r0 = COPY %3(p0)
60    BX_RET 14, $noreg, implicit $r0
61...
62---
63name:            test_select_s16
64# CHECK-LABEL: name: test_select_s16
65legalized:       false
66# CHECK: legalized: true
67regBankSelected: false
68selected:        false
69tracksRegLiveness: true
70registers:
71  - { id: 0, class: _ }
72  - { id: 1, class: _ }
73  - { id: 2, class: _ }
74  - { id: 3, class: _ }
75  - { id: 4, class: _ }
76  - { id: 5, class: _ }
77  - { id: 6, class: _ }
78body:             |
79  bb.0:
80    liveins: $r0, $r1, $r2
81
82    %0(s32) = COPY $r0
83    %1(s16) = G_TRUNC %0(s32)
84    %2(s32) = COPY $r1
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)
93    $r0 = COPY %6(s32)
94    BX_RET 14, $noreg, implicit $r0
95...
96---
97name:            test_select_s8
98# CHECK-LABEL: name: test_select_s8
99legalized:       false
100# CHECK: legalized: true
101regBankSelected: false
102selected:        false
103tracksRegLiveness: true
104registers:
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: _ }
112body:             |
113  bb.0:
114    liveins: $r0, $r1, $r2
115
116    %0(s32) = COPY $r0
117    %1(s8) = G_TRUNC %0(s32)
118    %2(s32) = COPY $r1
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)
127    $r0 = COPY %6(s32)
128    BX_RET 14, $noreg, implicit $r0
129...
130