Jim Grosbach | d3c7942 | 2014-07-23 20:46:32 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -asm-verbose=false -mtriple=arm64-apple-ios | FileCheck %s |
Jim Grosbach | f7502c4 | 2014-07-18 00:40:52 +0000 | [diff] [blame] | 2 | |
| 3 | define <4 x float> @foo(<4 x float> %val, <4 x float> %test) nounwind { |
| 4 | ; CHECK-LABEL: foo: |
| 5 | ; CHECK-NEXT: fcmeq.4s v0, v0, v1 |
| 6 | ; CHECK-NEXT: fmov.4s v1, #1.00000000 |
| 7 | ; CHECK-NEXT: and.16b v0, v0, v1 |
| 8 | ; CHECK-NEXT: ret |
| 9 | %cmp = fcmp oeq <4 x float> %val, %test |
| 10 | %ext = zext <4 x i1> %cmp to <4 x i32> |
| 11 | %result = sitofp <4 x i32> %ext to <4 x float> |
| 12 | ret <4 x float> %result |
| 13 | } |
Jim Grosbach | 8f6f085 | 2014-07-23 20:41:38 +0000 | [diff] [blame] | 14 | ; Make sure the operation doesn't try to get folded when the sizes don't match, |
| 15 | ; as that ends up crashing later when trying to form a bitcast operation for |
| 16 | ; the folded nodes. |
| 17 | define void @foo1(<4 x float> %val, <4 x float> %test, <4 x double>* %p) nounwind { |
| 18 | ; CHECK-LABEL: foo1: |
| 19 | ; CHECK: movi.4s |
| 20 | ; CHECK: scvtf.2d |
| 21 | ; CHECK: scvtf.2d |
| 22 | %cmp = fcmp oeq <4 x float> %val, %test |
| 23 | %ext = zext <4 x i1> %cmp to <4 x i32> |
| 24 | %result = sitofp <4 x i32> %ext to <4 x double> |
| 25 | store <4 x double> %result, <4 x double>* %p |
| 26 | ret void |
| 27 | } |
Jim Grosbach | 724e438 | 2014-07-23 20:41:43 +0000 | [diff] [blame] | 28 | |
| 29 | ; Fold explicit AND operations when the constant isn't a splat of a single |
| 30 | ; scalar value like what the zext creates. |
| 31 | define <4 x float> @foo2(<4 x float> %val, <4 x float> %test) nounwind { |
| 32 | ; CHECK-LABEL: lCPI2_0: |
| 33 | ; CHECK-NEXT: .long 1065353216 |
| 34 | ; CHECK-NEXT: .long 0 |
| 35 | ; CHECK-NEXT: .long 1065353216 |
| 36 | ; CHECK-NEXT: .long 0 |
| 37 | ; CHECK-LABEL: foo2: |
| 38 | ; CHECK: adrp x8, lCPI2_0@PAGE |
| 39 | ; CHECK: ldr q2, [x8, lCPI2_0@PAGEOFF] |
| 40 | ; CHECK-NEXT: fcmeq.4s v0, v0, v1 |
| 41 | ; CHECK-NEXT: and.16b v0, v0, v2 |
| 42 | %cmp = fcmp oeq <4 x float> %val, %test |
| 43 | %ext = zext <4 x i1> %cmp to <4 x i32> |
| 44 | %and = and <4 x i32> %ext, <i32 255, i32 256, i32 257, i32 258> |
| 45 | %result = sitofp <4 x i32> %and to <4 x float> |
| 46 | ret <4 x float> %result |
| 47 | } |