1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 2
2 # RUN: llc -mtriple=i386-linux-gnu -run-pass=legalizer %s -o - | FileCheck %s --check-prefixes=CHECK,X86
3 # RUN: llc -mtriple=x86_64-linux-gnu -run-pass=legalizer %s -o - | FileCheck %s --check-prefixes=CHECK,X64
12 ; CHECK-LABEL: name: test_selectp0
13 ; CHECK: [[DEF:%[0-9]+]]:_(p0) = IMPLICIT_DEF
14 ; CHECK-NEXT: [[DEF1:%[0-9]+]]:_(p0) = IMPLICIT_DEF
15 ; CHECK-NEXT: [[DEF2:%[0-9]+]]:_(s1) = IMPLICIT_DEF
16 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[DEF2]](s1)
17 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(p0) = G_SELECT [[ZEXT]](s32), [[DEF1]], [[DEF]]
18 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY [[SELECT]](p0)
19 ; CHECK-NEXT: RET 0, implicit [[COPY]](p0)
20 %0:_(p0) = IMPLICIT_DEF
21 %1:_(p0) = IMPLICIT_DEF
22 %2:_(s1) = IMPLICIT_DEF
23 %3:_(p0) = G_SELECT %2, %1, %0
24 %4:_(p0) = COPY %3(p0)
32 ; X86-LABEL: name: test_select64
33 ; X86: [[DEF:%[0-9]+]]:_(s64) = IMPLICIT_DEF
34 ; X86-NEXT: [[DEF1:%[0-9]+]]:_(s64) = IMPLICIT_DEF
35 ; X86-NEXT: [[DEF2:%[0-9]+]]:_(s1) = IMPLICIT_DEF
36 ; X86-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[DEF1]](s64)
37 ; X86-NEXT: [[UV2:%[0-9]+]]:_(s32), [[UV3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[DEF]](s64)
38 ; X86-NEXT: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[DEF2]](s1)
39 ; X86-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ZEXT]](s32), [[UV]], [[UV2]]
40 ; X86-NEXT: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[ZEXT]](s32), [[UV1]], [[UV3]]
41 ; X86-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[SELECT]](s32), [[SELECT1]](s32)
42 ; X86-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY [[MV]](s64)
43 ; X86-NEXT: RET 0, implicit [[COPY]](s64)
44 ; X64-LABEL: name: test_select64
45 ; X64: [[DEF:%[0-9]+]]:_(s64) = IMPLICIT_DEF
46 ; X64-NEXT: [[DEF1:%[0-9]+]]:_(s64) = IMPLICIT_DEF
47 ; X64-NEXT: [[DEF2:%[0-9]+]]:_(s1) = IMPLICIT_DEF
48 ; X64-NEXT: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[DEF2]](s1)
49 ; X64-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[ZEXT]](s32), [[DEF1]], [[DEF]]
50 ; X64-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY [[SELECT]](s64)
51 ; X64-NEXT: RET 0, implicit [[COPY]](s64)
52 %0:_(s64) = IMPLICIT_DEF
53 %1:_(s64) = IMPLICIT_DEF
54 %2:_(s1) = IMPLICIT_DEF
55 %3:_(s64) = G_SELECT %2, %1, %0
56 %4:_(s64) = COPY %3(s64)
64 ; CHECK-LABEL: name: test_select32
65 ; CHECK: [[DEF:%[0-9]+]]:_(s32) = IMPLICIT_DEF
66 ; CHECK-NEXT: [[DEF1:%[0-9]+]]:_(s32) = IMPLICIT_DEF
67 ; CHECK-NEXT: [[DEF2:%[0-9]+]]:_(s1) = IMPLICIT_DEF
68 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[DEF2]](s1)
69 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ZEXT]](s32), [[DEF1]], [[DEF]]
70 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY [[SELECT]](s32)
71 ; CHECK-NEXT: RET 0, implicit [[COPY]](s32)
72 %0:_(s32) = IMPLICIT_DEF
73 %1:_(s32) = IMPLICIT_DEF
74 %2:_(s1) = IMPLICIT_DEF
75 %3:_(s32) = G_SELECT %2, %1, %0
76 %4:_(s32) = COPY %3(s32)
84 ; CHECK-LABEL: name: test_select16
85 ; CHECK: [[DEF:%[0-9]+]]:_(s16) = IMPLICIT_DEF
86 ; CHECK-NEXT: [[DEF1:%[0-9]+]]:_(s16) = IMPLICIT_DEF
87 ; CHECK-NEXT: [[DEF2:%[0-9]+]]:_(s1) = IMPLICIT_DEF
88 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[DEF2]](s1)
89 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s16) = G_SELECT [[ZEXT]](s32), [[DEF1]], [[DEF]]
90 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s16) = COPY [[SELECT]](s16)
91 ; CHECK-NEXT: RET 0, implicit [[COPY]](s16)
92 %0:_(s16) = IMPLICIT_DEF
93 %1:_(s16) = IMPLICIT_DEF
94 %2:_(s1) = IMPLICIT_DEF
95 %3:_(s16) = G_SELECT %2, %1, %0
96 %4:_(s16) = COPY %3(s16)
104 ; CHECK-LABEL: name: test_select8
105 ; CHECK: [[DEF:%[0-9]+]]:_(s8) = IMPLICIT_DEF
106 ; CHECK-NEXT: [[DEF1:%[0-9]+]]:_(s8) = IMPLICIT_DEF
107 ; CHECK-NEXT: [[DEF2:%[0-9]+]]:_(s1) = IMPLICIT_DEF
108 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[DEF2]](s1)
109 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s8) = G_SELECT [[ZEXT]](s32), [[DEF1]], [[DEF]]
110 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s8) = COPY [[SELECT]](s8)
111 ; CHECK-NEXT: RET 0, implicit [[COPY]](s8)
112 %0:_(s8) = IMPLICIT_DEF
113 %1:_(s8) = IMPLICIT_DEF
114 %2:_(s1) = IMPLICIT_DEF
115 %3:_(s8) = G_SELECT %2, %1, %0
116 %4:_(s8) = COPY %3(s8)