blob: f7e95d0b5e1db4f910e4c333bfbad3f1e0b3166c [file] [log] [blame]
Saleem Abdulrasool72587352014-04-03 16:01:44 +00001; RUN: llc -mtriple=arm-eabi -mattr=+neon %s -o - | FileCheck %s
Bob Wilson2e076c42009-06-22 23:27:02 +00002
Chris Lattnerdc84b312009-07-08 00:46:57 +00003; This tests fcmp operations that do not map directly to NEON instructions.
Bob Wilson2e076c42009-06-22 23:27:02 +00004
5; une is implemented with VCEQ/VMVN
Nikita Popovbed1c7f2022-12-19 12:44:09 +01006define <2 x i32> @vcunef32(ptr %A, ptr %B) nounwind {
Stephen Lind24ab202013-07-14 06:24:09 +00007;CHECK-LABEL: vcunef32:
Bob Wilson0bf35c22009-09-15 20:58:02 +00008;CHECK: vceq.f32
9;CHECK-NEXT: vmvn
Nikita Popovbed1c7f2022-12-19 12:44:09 +010010 %tmp1 = load <2 x float>, ptr %A
11 %tmp2 = load <2 x float>, ptr %B
Sjoerd Meijera2ddddf2018-08-07 08:05:15 +000012 %tmp3 = fcmp une <2 x float> %tmp1, %tmp2
13 %tmp4 = sext <2 x i1> %tmp3 to <2 x i32>
14 ret <2 x i32> %tmp4
Bob Wilson2e076c42009-06-22 23:27:02 +000015}
16
17; olt is implemented with VCGT
Nikita Popovbed1c7f2022-12-19 12:44:09 +010018define <2 x i32> @vcoltf32(ptr %A, ptr %B) nounwind {
Stephen Lind24ab202013-07-14 06:24:09 +000019;CHECK-LABEL: vcoltf32:
Bob Wilson0bf35c22009-09-15 20:58:02 +000020;CHECK: vcgt.f32
Nikita Popovbed1c7f2022-12-19 12:44:09 +010021 %tmp1 = load <2 x float>, ptr %A
22 %tmp2 = load <2 x float>, ptr %B
Sjoerd Meijera2ddddf2018-08-07 08:05:15 +000023 %tmp3 = fcmp olt <2 x float> %tmp1, %tmp2
24 %tmp4 = sext <2 x i1> %tmp3 to <2 x i32>
25 ret <2 x i32> %tmp4
Bob Wilson2e076c42009-06-22 23:27:02 +000026}
27
28; ole is implemented with VCGE
Nikita Popovbed1c7f2022-12-19 12:44:09 +010029define <2 x i32> @vcolef32(ptr %A, ptr %B) nounwind {
Stephen Lind24ab202013-07-14 06:24:09 +000030;CHECK-LABEL: vcolef32:
Bob Wilson0bf35c22009-09-15 20:58:02 +000031;CHECK: vcge.f32
Nikita Popovbed1c7f2022-12-19 12:44:09 +010032 %tmp1 = load <2 x float>, ptr %A
33 %tmp2 = load <2 x float>, ptr %B
Sjoerd Meijera2ddddf2018-08-07 08:05:15 +000034 %tmp3 = fcmp ole <2 x float> %tmp1, %tmp2
35 %tmp4 = sext <2 x i1> %tmp3 to <2 x i32>
36 ret <2 x i32> %tmp4
Bob Wilson2e076c42009-06-22 23:27:02 +000037}
38
39; uge is implemented with VCGT/VMVN
Nikita Popovbed1c7f2022-12-19 12:44:09 +010040define <2 x i32> @vcugef32(ptr %A, ptr %B) nounwind {
Stephen Lind24ab202013-07-14 06:24:09 +000041;CHECK-LABEL: vcugef32:
Bob Wilson0bf35c22009-09-15 20:58:02 +000042;CHECK: vcgt.f32
43;CHECK-NEXT: vmvn
Nikita Popovbed1c7f2022-12-19 12:44:09 +010044 %tmp1 = load <2 x float>, ptr %A
45 %tmp2 = load <2 x float>, ptr %B
Sjoerd Meijera2ddddf2018-08-07 08:05:15 +000046 %tmp3 = fcmp uge <2 x float> %tmp1, %tmp2
47 %tmp4 = sext <2 x i1> %tmp3 to <2 x i32>
48 ret <2 x i32> %tmp4
Bob Wilson2e076c42009-06-22 23:27:02 +000049}
50
51; ule is implemented with VCGT/VMVN
Nikita Popovbed1c7f2022-12-19 12:44:09 +010052define <2 x i32> @vculef32(ptr %A, ptr %B) nounwind {
Stephen Lind24ab202013-07-14 06:24:09 +000053;CHECK-LABEL: vculef32:
Bob Wilson0bf35c22009-09-15 20:58:02 +000054;CHECK: vcgt.f32
55;CHECK-NEXT: vmvn
Nikita Popovbed1c7f2022-12-19 12:44:09 +010056 %tmp1 = load <2 x float>, ptr %A
57 %tmp2 = load <2 x float>, ptr %B
Sjoerd Meijera2ddddf2018-08-07 08:05:15 +000058 %tmp3 = fcmp ule <2 x float> %tmp1, %tmp2
59 %tmp4 = sext <2 x i1> %tmp3 to <2 x i32>
60 ret <2 x i32> %tmp4
Bob Wilson2e076c42009-06-22 23:27:02 +000061}
62
63; ugt is implemented with VCGE/VMVN
Nikita Popovbed1c7f2022-12-19 12:44:09 +010064define <2 x i32> @vcugtf32(ptr %A, ptr %B) nounwind {
Stephen Lind24ab202013-07-14 06:24:09 +000065;CHECK-LABEL: vcugtf32:
Bob Wilson0bf35c22009-09-15 20:58:02 +000066;CHECK: vcge.f32
67;CHECK-NEXT: vmvn
Nikita Popovbed1c7f2022-12-19 12:44:09 +010068 %tmp1 = load <2 x float>, ptr %A
69 %tmp2 = load <2 x float>, ptr %B
Sjoerd Meijera2ddddf2018-08-07 08:05:15 +000070 %tmp3 = fcmp ugt <2 x float> %tmp1, %tmp2
71 %tmp4 = sext <2 x i1> %tmp3 to <2 x i32>
72 ret <2 x i32> %tmp4
Bob Wilson2e076c42009-06-22 23:27:02 +000073}
74
75; ult is implemented with VCGE/VMVN
Nikita Popovbed1c7f2022-12-19 12:44:09 +010076define <2 x i32> @vcultf32(ptr %A, ptr %B) nounwind {
Stephen Lind24ab202013-07-14 06:24:09 +000077;CHECK-LABEL: vcultf32:
Bob Wilson0bf35c22009-09-15 20:58:02 +000078;CHECK: vcge.f32
79;CHECK-NEXT: vmvn
Nikita Popovbed1c7f2022-12-19 12:44:09 +010080 %tmp1 = load <2 x float>, ptr %A
81 %tmp2 = load <2 x float>, ptr %B
Sjoerd Meijera2ddddf2018-08-07 08:05:15 +000082 %tmp3 = fcmp ult <2 x float> %tmp1, %tmp2
83 %tmp4 = sext <2 x i1> %tmp3 to <2 x i32>
84 ret <2 x i32> %tmp4
Bob Wilson2e076c42009-06-22 23:27:02 +000085}
86
87; ueq is implemented with VCGT/VCGT/VORR/VMVN
Nikita Popovbed1c7f2022-12-19 12:44:09 +010088define <2 x i32> @vcueqf32(ptr %A, ptr %B) nounwind {
Stephen Lind24ab202013-07-14 06:24:09 +000089;CHECK-LABEL: vcueqf32:
Bob Wilson0bf35c22009-09-15 20:58:02 +000090;CHECK: vcgt.f32
91;CHECK-NEXT: vcgt.f32
92;CHECK-NEXT: vorr
93;CHECK-NEXT: vmvn
Nikita Popovbed1c7f2022-12-19 12:44:09 +010094 %tmp1 = load <2 x float>, ptr %A
95 %tmp2 = load <2 x float>, ptr %B
Sjoerd Meijera2ddddf2018-08-07 08:05:15 +000096 %tmp3 = fcmp ueq <2 x float> %tmp1, %tmp2
97 %tmp4 = sext <2 x i1> %tmp3 to <2 x i32>
98 ret <2 x i32> %tmp4
Bob Wilson2e076c42009-06-22 23:27:02 +000099}
100
101; one is implemented with VCGT/VCGT/VORR
Nikita Popovbed1c7f2022-12-19 12:44:09 +0100102define <2 x i32> @vconef32(ptr %A, ptr %B) nounwind {
Stephen Lind24ab202013-07-14 06:24:09 +0000103;CHECK-LABEL: vconef32:
Bob Wilson0bf35c22009-09-15 20:58:02 +0000104;CHECK: vcgt.f32
105;CHECK-NEXT: vcgt.f32
106;CHECK-NEXT: vorr
Nikita Popovbed1c7f2022-12-19 12:44:09 +0100107 %tmp1 = load <2 x float>, ptr %A
108 %tmp2 = load <2 x float>, ptr %B
Sjoerd Meijera2ddddf2018-08-07 08:05:15 +0000109 %tmp3 = fcmp one <2 x float> %tmp1, %tmp2
110 %tmp4 = sext <2 x i1> %tmp3 to <2 x i32>
111 ret <2 x i32> %tmp4
Bob Wilson2e076c42009-06-22 23:27:02 +0000112}
113
114; uno is implemented with VCGT/VCGE/VORR/VMVN
Nikita Popovbed1c7f2022-12-19 12:44:09 +0100115define <2 x i32> @vcunof32(ptr %A, ptr %B) nounwind {
Stephen Lind24ab202013-07-14 06:24:09 +0000116;CHECK-LABEL: vcunof32:
Bob Wilson0bf35c22009-09-15 20:58:02 +0000117;CHECK: vcge.f32
118;CHECK-NEXT: vcgt.f32
119;CHECK-NEXT: vorr
120;CHECK-NEXT: vmvn
Nikita Popovbed1c7f2022-12-19 12:44:09 +0100121 %tmp1 = load <2 x float>, ptr %A
122 %tmp2 = load <2 x float>, ptr %B
Sjoerd Meijera2ddddf2018-08-07 08:05:15 +0000123 %tmp3 = fcmp uno <2 x float> %tmp1, %tmp2
124 %tmp4 = sext <2 x i1> %tmp3 to <2 x i32>
125 ret <2 x i32> %tmp4
Bob Wilson2e076c42009-06-22 23:27:02 +0000126}
127
128; ord is implemented with VCGT/VCGE/VORR
Nikita Popovbed1c7f2022-12-19 12:44:09 +0100129define <2 x i32> @vcordf32(ptr %A, ptr %B) nounwind {
Stephen Lind24ab202013-07-14 06:24:09 +0000130;CHECK-LABEL: vcordf32:
Bob Wilson0bf35c22009-09-15 20:58:02 +0000131;CHECK: vcge.f32
132;CHECK-NEXT: vcgt.f32
133;CHECK-NEXT: vorr
Nikita Popovbed1c7f2022-12-19 12:44:09 +0100134 %tmp1 = load <2 x float>, ptr %A
135 %tmp2 = load <2 x float>, ptr %B
Sjoerd Meijera2ddddf2018-08-07 08:05:15 +0000136 %tmp3 = fcmp ord <2 x float> %tmp1, %tmp2
137 %tmp4 = sext <2 x i1> %tmp3 to <2 x i32>
138 ret <2 x i32> %tmp4
Bob Wilson2e076c42009-06-22 23:27:02 +0000139}