1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=arm64-apple-ios | FileCheck %s
4 define <4 x float> @foo(<4 x float> %val, <4 x float> %test) nounwind {
7 ; CHECK-NEXT: fmov.4s v2, #1.00000000
8 ; CHECK-NEXT: fcmeq.4s v0, v0, v1
9 ; CHECK-NEXT: and.16b v0, v0, v2
11 %cmp = fcmp oeq <4 x float> %val, %test
12 %ext = zext <4 x i1> %cmp to <4 x i32>
13 %result = sitofp <4 x i32> %ext to <4 x float>
14 ret <4 x float> %result
16 ; Make sure the operation doesn't try to get folded when the sizes don't match,
17 ; as that ends up crashing later when trying to form a bitcast operation for
19 define void @foo1(<4 x float> %val, <4 x float> %test, ptr %p) nounwind {
22 ; CHECK-NEXT: movi.4s v2, #1
23 ; CHECK-NEXT: fcmeq.4s v0, v0, v1
24 ; CHECK-NEXT: and.16b v0, v0, v2
25 ; CHECK-NEXT: ushll2.2d v1, v0, #0
26 ; CHECK-NEXT: ushll.2d v0, v0, #0
27 ; CHECK-NEXT: scvtf.2d v1, v1
28 ; CHECK-NEXT: scvtf.2d v0, v0
29 ; CHECK-NEXT: stp q0, q1, [x0]
31 %cmp = fcmp oeq <4 x float> %val, %test
32 %ext = zext <4 x i1> %cmp to <4 x i32>
33 %result = sitofp <4 x i32> %ext to <4 x double>
34 store <4 x double> %result, ptr %p
38 ; Fold explicit AND operations when the constant isn't a splat of a single
39 ; scalar value like what the zext creates.
40 define <4 x float> @foo2(<4 x float> %val, <4 x float> %test) nounwind {
43 ; CHECK-NEXT: fcmeq.4s v0, v0, v1
45 ; CHECK-NEXT: adrp x8, lCPI2_0@PAGE
47 ; CHECK-NEXT: ldr q1, [x8, lCPI2_0@PAGEOFF]
48 ; CHECK-NEXT: and.16b v0, v0, v1
50 ; CHECK-NEXT: .loh AdrpLdr Lloh0, Lloh1
51 %cmp = fcmp oeq <4 x float> %val, %test
52 %ext = zext <4 x i1> %cmp to <4 x i32>
53 %and = and <4 x i32> %ext, <i32 255, i32 256, i32 257, i32 258>
54 %result = sitofp <4 x i32> %and to <4 x float>
55 ret <4 x float> %result