Matt Arsenault | 7cddfed | 2016-07-25 20:02:54 +0000 | [diff] [blame^] | 1 | ; RUN: opt -S -scalarizer %s | FileCheck %s |
| 2 | |
| 3 | ; Unary fp |
| 4 | declare <2 x float> @llvm.sqrt.v2f32(<2 x float>) |
| 5 | |
| 6 | ; Binary fp |
| 7 | declare <2 x float> @llvm.minnum.v2f32(<2 x float>, <2 x float>) |
| 8 | |
| 9 | ; Ternary fp |
| 10 | declare <2 x float> @llvm.fma.v2f32(<2 x float>, <2 x float>, <2 x float>) |
| 11 | |
| 12 | ; Binary int |
| 13 | declare <2 x i32> @llvm.bswap.v2i32(<2 x i32>) |
| 14 | |
| 15 | ; Unary int plus constant scalar operand |
| 16 | declare <2 x i32> @llvm.ctlz.v2i32(<2 x i32>, i1) |
| 17 | |
| 18 | ; Unary fp plus any scalar operand |
| 19 | declare <2 x float> @llvm.powi.v2f32(<2 x float>, i32) |
| 20 | |
| 21 | ; CHECK-LABEL: @scalarize_sqrt_v2f32( |
| 22 | ; CHECK: %sqrt.i0 = call float @llvm.sqrt.f32(float %x.i0) |
| 23 | ; CHECK: %sqrt.i1 = call float @llvm.sqrt.f32(float %x.i1) |
| 24 | ; CHECK: %sqrt.upto0 = insertelement <2 x float> undef, float %sqrt.i0, i32 0 |
| 25 | ; CHECK: %sqrt = insertelement <2 x float> %sqrt.upto0, float %sqrt.i1, i32 1 |
| 26 | ; CHECK: ret <2 x float> %sqrt |
| 27 | define <2 x float> @scalarize_sqrt_v2f32(<2 x float> %x) #0 { |
| 28 | %sqrt = call <2 x float> @llvm.sqrt.v2f32(<2 x float> %x) |
| 29 | ret <2 x float> %sqrt |
| 30 | } |
| 31 | |
| 32 | ; CHECK-LABEL: @scalarize_minnum_v2f32( |
| 33 | ; CHECK: %minnum.i0 = call float @llvm.minnum.f32(float %x.i0, float %y.i0) |
| 34 | ; CHECK: %minnum.i1 = call float @llvm.minnum.f32(float %x.i1, float %y.i1) |
| 35 | ; CHECK: %minnum.upto0 = insertelement <2 x float> undef, float %minnum.i0, i32 0 |
| 36 | ; CHECK: %minnum = insertelement <2 x float> %minnum.upto0, float %minnum.i1, i32 1 |
| 37 | ; CHECK: ret <2 x float> %minnum |
| 38 | define <2 x float> @scalarize_minnum_v2f32(<2 x float> %x, <2 x float> %y) #0 { |
| 39 | %minnum = call <2 x float> @llvm.minnum.v2f32(<2 x float> %x, <2 x float> %y) |
| 40 | ret <2 x float> %minnum |
| 41 | } |
| 42 | |
| 43 | ; CHECK-LABEL: @scalarize_fma_v2f32( |
| 44 | ; CHECK: %fma.i0 = call float @llvm.fma.f32(float %x.i0, float %y.i0, float %z.i0) |
| 45 | ; CHECK: %fma.i1 = call float @llvm.fma.f32(float %x.i1, float %y.i1, float %z.i1) |
| 46 | ; CHECK: %fma.upto0 = insertelement <2 x float> undef, float %fma.i0, i32 0 |
| 47 | ; CHECK: %fma = insertelement <2 x float> %fma.upto0, float %fma.i1, i32 1 |
| 48 | ; CHECK: ret <2 x float> %fma |
| 49 | define <2 x float> @scalarize_fma_v2f32(<2 x float> %x, <2 x float> %y, <2 x float> %z) #0 { |
| 50 | %fma = call <2 x float> @llvm.fma.v2f32(<2 x float> %x, <2 x float> %y, <2 x float> %z) |
| 51 | ret <2 x float> %fma |
| 52 | } |
| 53 | |
| 54 | ; CHECK-LABEL: @scalarize_bswap_v2i32( |
| 55 | ; CHECK: %bswap.i0 = call i32 @llvm.bswap.i32(i32 %x.i0) |
| 56 | ; CHECK: %bswap.i1 = call i32 @llvm.bswap.i32(i32 %x.i1) |
| 57 | ; CHECK: %bswap.upto0 = insertelement <2 x i32> undef, i32 %bswap.i0, i32 0 |
| 58 | ; CHECK: %bswap = insertelement <2 x i32> %bswap.upto0, i32 %bswap.i1, i32 1 |
| 59 | ; CHECK: ret <2 x i32> %bswap |
| 60 | define <2 x i32> @scalarize_bswap_v2i32(<2 x i32> %x) #0 { |
| 61 | %bswap = call <2 x i32> @llvm.bswap.v2i32(<2 x i32> %x) |
| 62 | ret <2 x i32> %bswap |
| 63 | } |
| 64 | |
| 65 | ; CHECK-LABEL: @scalarize_ctlz_v2i32( |
| 66 | ; CHECK: %ctlz.i0 = call i32 @llvm.ctlz.i32(i32 %x.i0, i1 true) |
| 67 | ; CHECK: %ctlz.i1 = call i32 @llvm.ctlz.i32(i32 %x.i1, i1 true) |
| 68 | ; CHECK: %ctlz.upto0 = insertelement <2 x i32> undef, i32 %ctlz.i0, i32 0 |
| 69 | ; CHECK: %ctlz = insertelement <2 x i32> %ctlz.upto0, i32 %ctlz.i1, i32 1 |
| 70 | ; CHECK: ret <2 x i32> %ctlz |
| 71 | define <2 x i32> @scalarize_ctlz_v2i32(<2 x i32> %x) #0 { |
| 72 | %ctlz = call <2 x i32> @llvm.ctlz.v2i32(<2 x i32> %x, i1 true) |
| 73 | ret <2 x i32> %ctlz |
| 74 | } |
| 75 | |
| 76 | ; CHECK-LABEL: @scalarize_powi_v2f32( |
| 77 | ; CHECK: %powi.i0 = call float @llvm.powi.f32(float %x.i0, i32 %y) |
| 78 | ; CHECK: %powi.i1 = call float @llvm.powi.f32(float %x.i1, i32 %y) |
| 79 | ; CHECK: %powi.upto0 = insertelement <2 x float> undef, float %powi.i0, i32 0 |
| 80 | ; CHECK: %powi = insertelement <2 x float> %powi.upto0, float %powi.i1, i32 1 |
| 81 | ; CHECK: ret <2 x float> %powi |
| 82 | define <2 x float> @scalarize_powi_v2f32(<2 x float> %x, i32 %y) #0 { |
| 83 | %powi = call <2 x float> @llvm.powi.v2f32(<2 x float> %x, i32 %y) |
| 84 | ret <2 x float> %powi |
| 85 | } |