| 1 |
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py |
| 2 |
; RUN: opt -mtriple=aarch64 -passes=vector-combine -S %s | FileCheck %s |
| 3 |
|
| 4 |
define <8 x i32> @test1(<4 x i32> %0, <4 x i32> %1) { |
| 5 |
; CHECK-LABEL: @test1( |
| 6 |
; CHECK-NEXT: entry: |
| 7 |
; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <4 x i32> [[TMP0:%.*]], <4 x i32> [[TMP1:%.*]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> |
| 8 |
; CHECK-NEXT: [[TMP3:%.*]] = call <8 x i32> @llvm.abs.v8i32(<8 x i32> [[TMP2]], i1 false) |
| 9 |
; CHECK-NEXT: ret <8 x i32> [[TMP3]] |
| 10 |
; |
| 11 |
entry: |
| 12 |
%2 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %0, i1 false) |
| 13 |
%3 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %1, i1 false) |
| 14 |
%4 = shufflevector <4 x i32> %2, <4 x i32> %3, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> |
| 15 |
ret <8 x i32> %4 |
| 16 |
} |
| 17 |
|
| 18 |
define <8 x i32> @test2(<4 x i32> %0, <4 x i32> %1) { |
| 19 |
; CHECK-LABEL: @test2( |
| 20 |
; CHECK-NEXT: entry: |
| 21 |
; CHECK-NEXT: [[TMP2:%.*]] = call <4 x i32> @llvm.abs.v4i32(<4 x i32> [[TMP0:%.*]], i1 true) |
| 22 |
; CHECK-NEXT: [[TMP3:%.*]] = call <4 x i32> @llvm.abs.v4i32(<4 x i32> [[TMP1:%.*]], i1 false) |
| 23 |
; CHECK-NEXT: [[TMP4:%.*]] = shufflevector <4 x i32> [[TMP2]], <4 x i32> [[TMP3]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> |
| 24 |
; CHECK-NEXT: ret <8 x i32> [[TMP4]] |
| 25 |
; |
| 26 |
entry: |
| 27 |
%2 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %0, i1 true) |
| 28 |
%3 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %1, i1 false) |
| 29 |
%4 = shufflevector <4 x i32> %2, <4 x i32> %3, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> |
| 30 |
ret <8 x i32> %4 |
| 31 |
} |
| 32 |
|
| 33 |
define <8 x i32> @test3(<4 x i32> %0, <4 x i32> %1, <4 x i32> %2, <4 x i32> %3) { |
| 34 |
; CHECK-LABEL: @test3( |
| 35 |
; CHECK-NEXT: entry: |
| 36 |
; CHECK-NEXT: [[TMP4:%.*]] = shufflevector <4 x i32> [[TMP0:%.*]], <4 x i32> [[TMP2:%.*]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> |
| 37 |
; CHECK-NEXT: [[TMP5:%.*]] = shufflevector <4 x i32> [[TMP1:%.*]], <4 x i32> [[TMP3:%.*]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> |
| 38 |
; CHECK-NEXT: [[TMP6:%.*]] = call <8 x i32> @llvm.smax.v8i32(<8 x i32> [[TMP4]], <8 x i32> [[TMP5]]) |
| 39 |
; CHECK-NEXT: ret <8 x i32> [[TMP6]] |
| 40 |
; |
| 41 |
entry: |
| 42 |
%4 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %0, <4 x i32> %1) |
| 43 |
%5 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %2, <4 x i32> %3) |
| 44 |
%6 = shufflevector <4 x i32> %4, <4 x i32> %5, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> |
| 45 |
ret <8 x i32> %6 |
| 46 |
} |
| 47 |
|
| 48 |
define <8 x i1> @test4(<4 x float> %0, <4 x float> %1) { |
| 49 |
; CHECK-LABEL: @test4( |
| 50 |
; CHECK-NEXT: entry: |
| 51 |
; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <4 x float> [[TMP0:%.*]], <4 x float> [[TMP1:%.*]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> |
| 52 |
; CHECK-NEXT: [[TMP3:%.*]] = call <8 x i1> @llvm.is.fpclass.v8f32(<8 x float> [[TMP2]], i32 0) |
| 53 |
; CHECK-NEXT: ret <8 x i1> [[TMP3]] |
| 54 |
; |
| 55 |
entry: |
| 56 |
%2 = call <4 x i1> @llvm.is.fpclass.v4f32(<4 x float> %0, i32 0) |
| 57 |
%3 = call <4 x i1> @llvm.is.fpclass.v4f32(<4 x float> %1, i32 0) |
| 58 |
%4 = shufflevector <4 x i1> %2, <4 x i1> %3, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> |
| 59 |
ret <8 x i1> %4 |
| 60 |
} |
| 61 |
|
| 62 |
define <2 x i1> @test4b(<4 x float> %0, <4 x float> %1) { |
| 63 |
; CHECK-LABEL: @test4b( |
| 64 |
; CHECK-NEXT: entry: |
| 65 |
; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <4 x float> [[TMP0:%.*]], <4 x float> [[TMP1:%.*]], <2 x i32> <i32 0, i32 4> |
| 66 |
; CHECK-NEXT: [[TMP3:%.*]] = call <2 x i1> @llvm.is.fpclass.v2f32(<2 x float> [[TMP2]], i32 0) |
| 67 |
; CHECK-NEXT: ret <2 x i1> [[TMP3]] |
| 68 |
; |
| 69 |
entry: |
| 70 |
%2 = call <4 x i1> @llvm.is.fpclass.v4f32(<4 x float> %0, i32 0) |
| 71 |
%3 = call <4 x i1> @llvm.is.fpclass.v4f32(<4 x float> %1, i32 0) |
| 72 |
%4 = shufflevector <4 x i1> %2, <4 x i1> %3, <2 x i32> <i32 0, i32 4> |
| 73 |
ret <2 x i1> %4 |
| 74 |
} |
| 75 |
|
| 76 |
define <8 x float> @test5(<4 x float> %0, i32 %1, <4 x float> %2, <4 x i32> %3) { |
| 77 |
; CHECK-LABEL: @test5( |
| 78 |
; CHECK-NEXT: entry: |
| 79 |
; CHECK-NEXT: [[TMP4:%.*]] = call <4 x float> @llvm.powi.v4f32.i32(<4 x float> [[TMP0:%.*]], i32 [[TMP1:%.*]]) |
| 80 |
; CHECK-NEXT: [[TMP5:%.*]] = call <4 x float> @llvm.powi.v4f32.v4i32(<4 x float> [[TMP2:%.*]], <4 x i32> [[TMP3:%.*]]) |
| 81 |
; CHECK-NEXT: [[TMP6:%.*]] = shufflevector <4 x float> [[TMP4]], <4 x float> [[TMP5]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> |
| 82 |
; CHECK-NEXT: ret <8 x float> [[TMP6]] |
| 83 |
; |
| 84 |
entry: |
| 85 |
%4 = call <4 x float> @llvm.powi.v4f32.i32(<4 x float> %0, i32 %1) |
| 86 |
%5 = call <4 x float> @llvm.powi.v4f32.v4i32(<4 x float> %2, <4 x i32> %3) |
| 87 |
%6 = shufflevector <4 x float> %4, <4 x float> %5, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> |
| 88 |
ret <8 x float> %6 |
| 89 |
} |
| 90 |
|
| 91 |
define <2 x float> @test6(<4 x float> %a1, <4 x float> %b1, <4 x float> %c1, <4 x float> %a2, <4 x float> %b2, <4 x float> %c2) { |
| 92 |
; CHECK-LABEL: @test6( |
| 93 |
; CHECK-NEXT: [[F1:%.*]] = call <4 x float> @llvm.fma.v4f32(<4 x float> [[A1:%.*]], <4 x float> [[B1:%.*]], <4 x float> [[C1:%.*]]) |
| 94 |
; CHECK-NEXT: [[F2:%.*]] = call <4 x float> @llvm.fma.v4f32(<4 x float> [[A2:%.*]], <4 x float> [[B2:%.*]], <4 x float> [[C2:%.*]]) |
| 95 |
; CHECK-NEXT: [[S:%.*]] = shufflevector <4 x float> [[F1]], <4 x float> [[F2]], <2 x i32> <i32 0, i32 4> |
| 96 |
; CHECK-NEXT: ret <2 x float> [[S]] |
| 97 |
; |
| 98 |
%f1 = call <4 x float> @llvm.fma.v4f32(<4 x float> %a1, <4 x float> %b1, <4 x float> %c1) |
| 99 |
%f2 = call <4 x float> @llvm.fma.v4f32(<4 x float> %a2, <4 x float> %b2, <4 x float> %c2) |
| 100 |
%s = shufflevector <4 x float> %f1, <4 x float> %f2, <2 x i32> <i32 0, i32 4> |
| 101 |
ret <2 x float> %s |
| 102 |
} |
| 103 |
|
| 104 |
|
| 105 |
declare <4 x i32> @llvm.abs.v4i32(<4 x i32>, i1) |
| 106 |
declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>) |
| 107 |
declare <4 x i1> @llvm.is.fpclass.v4f32(<4 x float>, i32) |
| 108 |
declare <4 x float> @llvm.powi.v4f32.i32(<4 x float>, i32) |
| 109 |
declare <4 x float> @llvm.powi.v4f32.v4i32(<4 x float>, <4 x i32>) |