1 ; RUN: llc -verify-machineinstrs < %s -mcpu=a2q | FileCheck %s
2 target triple = "powerpc64-bgq-linux"
4 @R = global <4 x i1> <i1 0, i1 0, i1 0, i1 0>, align 16
6 define <4 x float> @test1(<4 x float> %a, <4 x float> %b, <4 x i1> %c) nounwind readnone {
8 %r = select <4 x i1> %c, <4 x float> %a, <4 x float> %b
12 ; CHECK: qvfsel 1, 3, 1, 2
16 define <4 x float> @test2(<4 x float> %a, <4 x float> %b, i1 %c1, i1 %c2, i1 %c3, i1 %c4) nounwind readnone {
18 %v = insertelement <4 x i1> undef, i1 %c1, i32 0
19 %v2 = insertelement <4 x i1> %v, i1 %c2, i32 1
20 %v3 = insertelement <4 x i1> %v2, i1 %c3, i32 2
21 %v4 = insertelement <4 x i1> %v3, i1 %c4, i32 3
22 %r = select <4 x i1> %v4, <4 x float> %a, <4 x float> %b
27 ; CHECK-DAG: qvlfiwzx [[REG1:[0-9]+]],
28 ; CHECK-DAG: qvlfdx [[REG2:[0-9]+]],
29 ; CHECK-DAG: qvfcfidu [[REG3:[0-9]+]], [[REG1]]
30 ; CHECK: qvfcmpeq [[REG4:[0-9]+]], [[REG3]], [[REG2]]
31 ; CHECK: qvfsel 1, [[REG4]], 1, 2
35 define <4 x i1> @test3(<4 x i1> %a) nounwind readnone {
37 %v = and <4 x i1> %a, <i1 0, i1 undef, i1 1, i1 1>
41 ; CHECK: qvlfsx [[REG:[0-9]+]],
42 ; qvflogical 1, 1, [[REG]], 1
46 define <4 x i1> @test4(<4 x i1> %a, <4 x i1>* %t) nounwind {
48 %q = load <4 x i1>, <4 x i1>* %t, align 16
49 %v = and <4 x i1> %a, %q
54 ; CHECK-DAG: qvlfdx [[REG1:[0-9]+]],
56 ; CHECK-DAG: qvlfiwzx [[REG2:[0-9]+]],
57 ; CHECK-DAG: qvfcfidu [[REG3:[0-9]+]], [[REG2]]
58 ; CHECK: qvfcmpeq [[REG4:[0-9]+]], [[REG3]], [[REG1]]
59 ; CHECK: qvflogical 1, 1, [[REG4]], 1
63 define void @test5(<4 x i1> %a) nounwind {
65 store <4 x i1> %a, <4 x i1>* @R
69 ; CHECK: qvlfdx [[REG1:[0-9]+]],
70 ; CHECK: qvfmadd [[REG2:[0-9]+]], 1, [[REG1]], [[REG1]]
71 ; CHECK: qvfctiwu [[REG3:[0-9]+]], [[REG2]]
72 ; CHECK: qvstfiwx [[REG3]],
78 define i1 @test6(<4 x i1> %a) nounwind {
80 %r = extractelement <4 x i1> %a, i32 2
84 ; CHECK: qvlfdx [[REG1:[0-9]+]],
85 ; CHECK: qvfmadd [[REG2:[0-9]+]], 1, [[REG1]], [[REG1]]
86 ; CHECK: qvfctiwu [[REG3:[0-9]+]], [[REG2]]
87 ; CHECK: qvstfiwx [[REG3]],
92 define i1 @test7(<4 x i1> %a) nounwind {
94 %r = extractelement <4 x i1> %a, i32 2
95 %s = extractelement <4 x i1> %a, i32 3
100 ; CHECK: qvlfdx [[REG1:[0-9]+]],
101 ; CHECK: qvfmadd [[REG2:[0-9]+]], 1, [[REG1]], [[REG1]]
102 ; CHECK: qvfctiwu [[REG3:[0-9]+]], [[REG2]]
103 ; CHECK: qvstfiwx [[REG3]],
104 ; CHECK-DAG: lwz [[REG4:[0-9]+]],
105 ; FIXME: We're storing the vector twice, and that's silly.
106 ; CHECK-DAG: qvstfiwx [[REG3]],
107 ; CHECK: lwz [[REG5:[0-9]+]],
112 define i1 @test8(<3 x i1> %a) nounwind {
114 %r = extractelement <3 x i1> %a, i32 2
117 ; CHECK-LABEL: @test8
118 ; CHECK: qvlfdx [[REG1:[0-9]+]],
119 ; CHECK: qvfmadd [[REG2:[0-9]+]], 1, [[REG1]], [[REG1]]
120 ; CHECK: qvfctiwu [[REG3:[0-9]+]], [[REG2]]
121 ; CHECK: qvstfiwx [[REG3]],
126 define <3 x float> @test9(<3 x float> %a, <3 x float> %b, i1 %c1, i1 %c2, i1 %c3) nounwind readnone {
128 %v = insertelement <3 x i1> undef, i1 %c1, i32 0
129 %v2 = insertelement <3 x i1> %v, i1 %c2, i32 1
130 %v3 = insertelement <3 x i1> %v2, i1 %c3, i32 2
131 %r = select <3 x i1> %v3, <3 x float> %a, <3 x float> %b
134 ; CHECK-LABEL: @test9
136 ; CHECK-DAG: qvlfiwzx [[REG1:[0-9]+]],
137 ; CHECK-DAG: qvlfdx [[REG2:[0-9]+]],
138 ; CHECK-DAG: qvfcfidu [[REG3:[0-9]+]], [[REG1]]
139 ; CHECK: qvfcmpeq [[REG4:[0-9]+]], [[REG3]], [[REG2]]
140 ; CHECK: qvfsel 1, [[REG4]], 1, 2