diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2016-06-16 18:44:20 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2016-06-16 18:44:20 +0000 |
| commit | 0e9afea3c83c885fa7e149342fc3e3337af8bc22 (patch) | |
| tree | fc800483b3a5f70391611153174fa42d422769c6 /llvm/test | |
| parent | 6d0042642a5baa58032502458bdcf8cd14e83e88 (diff) | |
| download | bcm5719-llvm-0e9afea3c83c885fa7e149342fc3e3337af8bc22.tar.gz bcm5719-llvm-0e9afea3c83c885fa7e149342fc3e3337af8bc22.zip | |
[x86] autoupgrade and remove AVX2 integer min/max intrinsics
This will (hopefully very temporarily) break clang.
The clang side of this should be the next commit.
llvm-svn: 272932
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/CodeGen/X86/avx2-intrinsics-fast-isel.ll | 72 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/avx2-intrinsics-x86-upgrade.ll | 137 |
2 files changed, 170 insertions, 39 deletions
diff --git a/llvm/test/CodeGen/X86/avx2-intrinsics-fast-isel.ll b/llvm/test/CodeGen/X86/avx2-intrinsics-fast-isel.ll index b9f1f2283f2..4f410b415c0 100644 --- a/llvm/test/CodeGen/X86/avx2-intrinsics-fast-isel.ll +++ b/llvm/test/CodeGen/X86/avx2-intrinsics-fast-isel.ll @@ -1931,11 +1931,11 @@ define <4 x i64> @test_mm256_max_epi8(<4 x i64> %a0, <4 x i64> %a1) { ; X64-NEXT: retq %arg0 = bitcast <4 x i64> %a0 to <32 x i8> %arg1 = bitcast <4 x i64> %a1 to <32 x i8> - %res = call <32 x i8> @llvm.x86.avx2.pmaxs.b(<32 x i8> %arg0, <32 x i8> %arg1) - %bc = bitcast <32 x i8> %res to <4 x i64> + %cmp = icmp sgt <32 x i8> %arg0, %arg1 + %sel = select <32 x i1> %cmp, <32 x i8> %arg0, <32 x i8> %arg1 + %bc = bitcast <32 x i8> %sel to <4 x i64> ret <4 x i64> %bc } -declare <32 x i8> @llvm.x86.avx2.pmaxs.b(<32 x i8>, <32 x i8>) nounwind readnone define <4 x i64> @test_mm256_max_epi16(<4 x i64> %a0, <4 x i64> %a1) { ; X32-LABEL: test_mm256_max_epi16: @@ -1949,11 +1949,11 @@ define <4 x i64> @test_mm256_max_epi16(<4 x i64> %a0, <4 x i64> %a1) { ; X64-NEXT: retq %arg0 = bitcast <4 x i64> %a0 to <16 x i16> %arg1 = bitcast <4 x i64> %a1 to <16 x i16> - %res = call <16 x i16> @llvm.x86.avx2.pmaxs.w(<16 x i16> %arg0, <16 x i16> %arg1) - %bc = bitcast <16 x i16> %res to <4 x i64> + %cmp = icmp sgt <16 x i16> %arg0, %arg1 + %sel = select <16 x i1> %cmp, <16 x i16> %arg0, <16 x i16> %arg1 + %bc = bitcast <16 x i16> %sel to <4 x i64> ret <4 x i64> %bc } -declare <16 x i16> @llvm.x86.avx2.pmaxs.w(<16 x i16>, <16 x i16>) nounwind readnone define <4 x i64> @test_mm256_max_epi32(<4 x i64> %a0, <4 x i64> %a1) { ; X32-LABEL: test_mm256_max_epi32: @@ -1967,11 +1967,11 @@ define <4 x i64> @test_mm256_max_epi32(<4 x i64> %a0, <4 x i64> %a1) { ; X64-NEXT: retq %arg0 = bitcast <4 x i64> %a0 to <8 x i32> %arg1 = bitcast <4 x i64> %a1 to <8 x i32> - %res = call <8 x i32> @llvm.x86.avx2.pmaxs.d(<8 x i32> %arg0, <8 x i32> %arg1) - %bc = bitcast <8 x i32> %res to <4 x i64> + %cmp = icmp sgt <8 x i32> %arg0, %arg1 + %sel = select <8 x i1> %cmp, <8 x i32> %arg0, <8 x i32> %arg1 + %bc = bitcast <8 x i32> %sel to <4 x i64> ret <4 x i64> %bc } -declare <8 x i32> @llvm.x86.avx2.pmaxs.d(<8 x i32>, <8 x i32>) nounwind readnone define <4 x i64> @test_mm256_max_epu8(<4 x i64> %a0, <4 x i64> %a1) { ; X32-LABEL: test_mm256_max_epu8: @@ -1985,11 +1985,11 @@ define <4 x i64> @test_mm256_max_epu8(<4 x i64> %a0, <4 x i64> %a1) { ; X64-NEXT: retq %arg0 = bitcast <4 x i64> %a0 to <32 x i8> %arg1 = bitcast <4 x i64> %a1 to <32 x i8> - %res = call <32 x i8> @llvm.x86.avx2.pmaxu.b(<32 x i8> %arg0, <32 x i8> %arg1) - %bc = bitcast <32 x i8> %res to <4 x i64> + %cmp = icmp ugt <32 x i8> %arg0, %arg1 + %sel = select <32 x i1> %cmp, <32 x i8> %arg0, <32 x i8> %arg1 + %bc = bitcast <32 x i8> %sel to <4 x i64> ret <4 x i64> %bc } -declare <32 x i8> @llvm.x86.avx2.pmaxu.b(<32 x i8>, <32 x i8>) nounwind readnone define <4 x i64> @test_mm256_max_epu16(<4 x i64> %a0, <4 x i64> %a1) { ; X32-LABEL: test_mm256_max_epu16: @@ -2003,11 +2003,11 @@ define <4 x i64> @test_mm256_max_epu16(<4 x i64> %a0, <4 x i64> %a1) { ; X64-NEXT: retq %arg0 = bitcast <4 x i64> %a0 to <16 x i16> %arg1 = bitcast <4 x i64> %a1 to <16 x i16> - %res = call <16 x i16> @llvm.x86.avx2.pmaxu.w(<16 x i16> %arg0, <16 x i16> %arg1) - %bc = bitcast <16 x i16> %res to <4 x i64> + %cmp = icmp ugt <16 x i16> %arg0, %arg1 + %sel = select <16 x i1> %cmp, <16 x i16> %arg0, <16 x i16> %arg1 + %bc = bitcast <16 x i16> %sel to <4 x i64> ret <4 x i64> %bc } -declare <16 x i16> @llvm.x86.avx2.pmaxu.w(<16 x i16>, <16 x i16>) nounwind readnone define <4 x i64> @test_mm256_max_epu32(<4 x i64> %a0, <4 x i64> %a1) { ; X32-LABEL: test_mm256_max_epu32: @@ -2021,11 +2021,11 @@ define <4 x i64> @test_mm256_max_epu32(<4 x i64> %a0, <4 x i64> %a1) { ; X64-NEXT: retq %arg0 = bitcast <4 x i64> %a0 to <8 x i32> %arg1 = bitcast <4 x i64> %a1 to <8 x i32> - %res = call <8 x i32> @llvm.x86.avx2.pmaxu.d(<8 x i32> %arg0, <8 x i32> %arg1) - %bc = bitcast <8 x i32> %res to <4 x i64> + %cmp = icmp ugt <8 x i32> %arg0, %arg1 + %sel = select <8 x i1> %cmp, <8 x i32> %arg0, <8 x i32> %arg1 + %bc = bitcast <8 x i32> %sel to <4 x i64> ret <4 x i64> %bc } -declare <8 x i32> @llvm.x86.avx2.pmaxu.d(<8 x i32>, <8 x i32>) nounwind readnone define <4 x i64> @test_mm256_min_epi8(<4 x i64> %a0, <4 x i64> %a1) { ; X32-LABEL: test_mm256_min_epi8: @@ -2039,11 +2039,11 @@ define <4 x i64> @test_mm256_min_epi8(<4 x i64> %a0, <4 x i64> %a1) { ; X64-NEXT: retq %arg0 = bitcast <4 x i64> %a0 to <32 x i8> %arg1 = bitcast <4 x i64> %a1 to <32 x i8> - %res = call <32 x i8> @llvm.x86.avx2.pmins.b(<32 x i8> %arg0, <32 x i8> %arg1) - %bc = bitcast <32 x i8> %res to <4 x i64> + %cmp = icmp slt <32 x i8> %arg0, %arg1 + %sel = select <32 x i1> %cmp, <32 x i8> %arg0, <32 x i8> %arg1 + %bc = bitcast <32 x i8> %sel to <4 x i64> ret <4 x i64> %bc } -declare <32 x i8> @llvm.x86.avx2.pmins.b(<32 x i8>, <32 x i8>) nounwind readnone define <4 x i64> @test_mm256_min_epi16(<4 x i64> %a0, <4 x i64> %a1) { ; X32-LABEL: test_mm256_min_epi16: @@ -2057,11 +2057,11 @@ define <4 x i64> @test_mm256_min_epi16(<4 x i64> %a0, <4 x i64> %a1) { ; X64-NEXT: retq %arg0 = bitcast <4 x i64> %a0 to <16 x i16> %arg1 = bitcast <4 x i64> %a1 to <16 x i16> - %res = call <16 x i16> @llvm.x86.avx2.pmins.w(<16 x i16> %arg0, <16 x i16> %arg1) - %bc = bitcast <16 x i16> %res to <4 x i64> + %cmp = icmp slt <16 x i16> %arg0, %arg1 + %sel = select <16 x i1> %cmp, <16 x i16> %arg0, <16 x i16> %arg1 + %bc = bitcast <16 x i16> %sel to <4 x i64> ret <4 x i64> %bc } -declare <16 x i16> @llvm.x86.avx2.pmins.w(<16 x i16>, <16 x i16>) nounwind readnone define <4 x i64> @test_mm256_min_epi32(<4 x i64> %a0, <4 x i64> %a1) { ; X32-LABEL: test_mm256_min_epi32: @@ -2075,11 +2075,11 @@ define <4 x i64> @test_mm256_min_epi32(<4 x i64> %a0, <4 x i64> %a1) { ; X64-NEXT: retq %arg0 = bitcast <4 x i64> %a0 to <8 x i32> %arg1 = bitcast <4 x i64> %a1 to <8 x i32> - %res = call <8 x i32> @llvm.x86.avx2.pmins.d(<8 x i32> %arg0, <8 x i32> %arg1) - %bc = bitcast <8 x i32> %res to <4 x i64> + %cmp = icmp slt <8 x i32> %arg0, %arg1 + %sel = select <8 x i1> %cmp, <8 x i32> %arg0, <8 x i32> %arg1 + %bc = bitcast <8 x i32> %sel to <4 x i64> ret <4 x i64> %bc } -declare <8 x i32> @llvm.x86.avx2.pmins.d(<8 x i32>, <8 x i32>) nounwind readnone define <4 x i64> @test_mm256_min_epu8(<4 x i64> %a0, <4 x i64> %a1) { ; X32-LABEL: test_mm256_min_epu8: @@ -2093,11 +2093,11 @@ define <4 x i64> @test_mm256_min_epu8(<4 x i64> %a0, <4 x i64> %a1) { ; X64-NEXT: retq %arg0 = bitcast <4 x i64> %a0 to <32 x i8> %arg1 = bitcast <4 x i64> %a1 to <32 x i8> - %res = call <32 x i8> @llvm.x86.avx2.pminu.b(<32 x i8> %arg0, <32 x i8> %arg1) - %bc = bitcast <32 x i8> %res to <4 x i64> + %cmp = icmp ult <32 x i8> %arg0, %arg1 + %sel = select <32 x i1> %cmp, <32 x i8> %arg0, <32 x i8> %arg1 + %bc = bitcast <32 x i8> %sel to <4 x i64> ret <4 x i64> %bc } -declare <32 x i8> @llvm.x86.avx2.pminu.b(<32 x i8>, <32 x i8>) nounwind readnone define <4 x i64> @test_mm256_min_epu16(<4 x i64> %a0, <4 x i64> %a1) { ; X32-LABEL: test_mm256_min_epu16: @@ -2111,11 +2111,11 @@ define <4 x i64> @test_mm256_min_epu16(<4 x i64> %a0, <4 x i64> %a1) { ; X64-NEXT: retq %arg0 = bitcast <4 x i64> %a0 to <16 x i16> %arg1 = bitcast <4 x i64> %a1 to <16 x i16> - %res = call <16 x i16> @llvm.x86.avx2.pminu.w(<16 x i16> %arg0, <16 x i16> %arg1) - %bc = bitcast <16 x i16> %res to <4 x i64> + %cmp = icmp ult <16 x i16> %arg0, %arg1 + %sel = select <16 x i1> %cmp, <16 x i16> %arg0, <16 x i16> %arg1 + %bc = bitcast <16 x i16> %sel to <4 x i64> ret <4 x i64> %bc } -declare <16 x i16> @llvm.x86.avx2.pminu.w(<16 x i16>, <16 x i16>) nounwind readnone define <4 x i64> @test_mm256_min_epu32(<4 x i64> %a0, <4 x i64> %a1) { ; X32-LABEL: test_mm256_min_epu32: @@ -2129,11 +2129,11 @@ define <4 x i64> @test_mm256_min_epu32(<4 x i64> %a0, <4 x i64> %a1) { ; X64-NEXT: retq %arg0 = bitcast <4 x i64> %a0 to <8 x i32> %arg1 = bitcast <4 x i64> %a1 to <8 x i32> - %res = call <8 x i32> @llvm.x86.avx2.pminu.d(<8 x i32> %arg0, <8 x i32> %arg1) - %bc = bitcast <8 x i32> %res to <4 x i64> + %cmp = icmp ult <8 x i32> %arg0, %arg1 + %sel = select <8 x i1> %cmp, <8 x i32> %arg0, <8 x i32> %arg1 + %bc = bitcast <8 x i32> %sel to <4 x i64> ret <4 x i64> %bc } -declare <8 x i32> @llvm.x86.avx2.pminu.d(<8 x i32>, <8 x i32>) nounwind readnone define i32 @test_mm256_movemask_epi8(<4 x i64> %a0) nounwind { ; X32-LABEL: test_mm256_movemask_epi8: diff --git a/llvm/test/CodeGen/X86/avx2-intrinsics-x86-upgrade.ll b/llvm/test/CodeGen/X86/avx2-intrinsics-x86-upgrade.ll index 2c7d055fe2a..b6b8447beda 100644 --- a/llvm/test/CodeGen/X86/avx2-intrinsics-x86-upgrade.ll +++ b/llvm/test/CodeGen/X86/avx2-intrinsics-x86-upgrade.ll @@ -1,4 +1,4 @@ -; NOTE: Assertions have been autogenerated by update_llc_test_checks.py +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: llc < %s -mtriple=x86_64-apple-darwin -march=x86 -mattr=avx2 | FileCheck %s define <16 x i16> @test_x86_avx2_pblendw(<16 x i16> %a0, <16 x i16> %a1) { @@ -95,7 +95,6 @@ define <2 x i64> @test_x86_avx2_vextracti128(<4 x i64> %a0) { ; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm0 ; CHECK-NEXT: vzeroupper ; CHECK-NEXT: retl - %res = call <2 x i64> @llvm.x86.avx2.vextracti128(<4 x i64> %a0, i8 7) ret <2 x i64> %res } @@ -107,7 +106,6 @@ define <4 x i64> @test_x86_avx2_vinserti128(<4 x i64> %a0, <2 x i64> %a1) { ; CHECK: ## BB#0: ; CHECK-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0 ; CHECK-NEXT: retl - %res = call <4 x i64> @llvm.x86.avx2.vinserti128(<4 x i64> %a0, <2 x i64> %a1, i8 7) ret <4 x i64> %res } @@ -381,3 +379,136 @@ define void @test_x86_avx_storeu_dq_256(i8* %a0, <32 x i8> %a1) { ret void } declare void @llvm.x86.avx.storeu.dq.256(i8*, <32 x i8>) nounwind + +define <32 x i8> @mm256_max_epi8(<32 x i8> %a0, <32 x i8> %a1) { +; CHECK-LABEL: mm256_max_epi8: +; CHECK: ## BB#0: +; CHECK-NEXT: vpmaxsb %ymm1, %ymm0, %ymm0 +; CHECK-NEXT: retl +; + %res = call <32 x i8> @llvm.x86.avx2.pmaxs.b(<32 x i8> %a0, <32 x i8> %a1) + ret <32 x i8> %res +} +declare <32 x i8> @llvm.x86.avx2.pmaxs.b(<32 x i8>, <32 x i8>) nounwind readnone + +define <16 x i16> @mm256_max_epi16(<16 x i16> %a0, <16 x i16> %a1) { +; CHECK-LABEL: mm256_max_epi16: +; CHECK: ## BB#0: +; CHECK-NEXT: vpmaxsw %ymm1, %ymm0, %ymm0 +; CHECK-NEXT: retl +; + %res = call <16 x i16> @llvm.x86.avx2.pmaxs.w(<16 x i16> %a0, <16 x i16> %a1) + ret <16 x i16> %res +} +declare <16 x i16> @llvm.x86.avx2.pmaxs.w(<16 x i16>, <16 x i16>) nounwind readnone + +define <8 x i32> @mm256_max_epi32(<8 x i32> %a0, <8 x i32> %a1) { +; CHECK-LABEL: mm256_max_epi32: +; CHECK: ## BB#0: +; CHECK-NEXT: vpmaxsd %ymm1, %ymm0, %ymm0 +; CHECK-NEXT: retl +; + %res = call <8 x i32> @llvm.x86.avx2.pmaxs.d(<8 x i32> %a0, <8 x i32> %a1) + ret <8 x i32> %res +} +declare <8 x i32> @llvm.x86.avx2.pmaxs.d(<8 x i32>, <8 x i32>) nounwind readnone + +define <32 x i8> @mm256_max_epu8(<32 x i8> %a0, <32 x i8> %a1) { +; CHECK-LABEL: mm256_max_epu8: +; CHECK: ## BB#0: +; CHECK-NEXT: vpmaxub %ymm1, %ymm0, %ymm0 +; CHECK-NEXT: retl +; + %res = call <32 x i8> @llvm.x86.avx2.pmaxu.b(<32 x i8> %a0, <32 x i8> %a1) + ret <32 x i8> %res +} +declare <32 x i8> @llvm.x86.avx2.pmaxu.b(<32 x i8>, <32 x i8>) nounwind readnone + +define <16 x i16> @mm256_max_epu16(<16 x i16> %a0, <16 x i16> %a1) { +; CHECK-LABEL: mm256_max_epu16: +; CHECK: ## BB#0: +; CHECK-NEXT: vpmaxuw %ymm1, %ymm0, %ymm0 +; CHECK-NEXT: retl +; + %res = call <16 x i16> @llvm.x86.avx2.pmaxu.w(<16 x i16> %a0, <16 x i16> %a1) + ret <16 x i16> %res +} +declare <16 x i16> @llvm.x86.avx2.pmaxu.w(<16 x i16>, <16 x i16>) nounwind readnone + +define <8 x i32> @mm256_max_epu32(<8 x i32> %a0, <8 x i32> %a1) { +; CHECK-LABEL: mm256_max_epu32: +; CHECK: ## BB#0: +; CHECK-NEXT: vpmaxud %ymm1, %ymm0, %ymm0 +; CHECK-NEXT: retl +; + %res = call <8 x i32> @llvm.x86.avx2.pmaxu.d(<8 x i32> %a0, <8 x i32> %a1) + ret <8 x i32> %res +} +declare <8 x i32> @llvm.x86.avx2.pmaxu.d(<8 x i32>, <8 x i32>) nounwind readnone + +define <32 x i8> @mm256_min_epi8(<32 x i8> %a0, <32 x i8> %a1) { +; CHECK-LABEL: mm256_min_epi8: +; CHECK: ## BB#0: +; CHECK-NEXT: vpminsb %ymm1, %ymm0, %ymm0 +; CHECK-NEXT: retl +; + %res = call <32 x i8> @llvm.x86.avx2.pmins.b(<32 x i8> %a0, <32 x i8> %a1) + ret <32 x i8> %res +} +declare <32 x i8> @llvm.x86.avx2.pmins.b(<32 x i8>, <32 x i8>) nounwind readnone + +define <16 x i16> @mm256_min_epi16(<16 x i16> %a0, <16 x i16> %a1) { +; CHECK-LABEL: mm256_min_epi16: +; CHECK: ## BB#0: +; CHECK-NEXT: vpminsw %ymm1, %ymm0, %ymm0 +; CHECK-NEXT: retl +; + %res = call <16 x i16> @llvm.x86.avx2.pmins.w(<16 x i16> %a0, <16 x i16> %a1) + ret <16 x i16> %res +} +declare <16 x i16> @llvm.x86.avx2.pmins.w(<16 x i16>, <16 x i16>) nounwind readnone + +define <8 x i32> @mm256_min_epi32(<8 x i32> %a0, <8 x i32> %a1) { +; CHECK-LABEL: mm256_min_epi32: +; CHECK: ## BB#0: +; CHECK-NEXT: vpminsd %ymm1, %ymm0, %ymm0 +; CHECK-NEXT: retl +; + %res = call <8 x i32> @llvm.x86.avx2.pmins.d(<8 x i32> %a0, <8 x i32> %a1) + ret <8 x i32> %res +} +declare <8 x i32> @llvm.x86.avx2.pmins.d(<8 x i32>, <8 x i32>) nounwind readnone + +define <32 x i8> @mm256_min_epu8(<32 x i8> %a0, <32 x i8> %a1) { +; CHECK-LABEL: mm256_min_epu8: +; CHECK: ## BB#0: +; CHECK-NEXT: vpminub %ymm1, %ymm0, %ymm0 +; CHECK-NEXT: retl +; + %res = call <32 x i8> @llvm.x86.avx2.pminu.b(<32 x i8> %a0, <32 x i8> %a1) + ret <32 x i8> %res +} +declare <32 x i8> @llvm.x86.avx2.pminu.b(<32 x i8>, <32 x i8>) nounwind readnone + +define <16 x i16> @mm256_min_epu16(<16 x i16> %a0, <16 x i16> %a1) { +; CHECK-LABEL: mm256_min_epu16: +; CHECK: ## BB#0: +; CHECK-NEXT: vpminuw %ymm1, %ymm0, %ymm0 +; CHECK-NEXT: retl +; + %res = call <16 x i16> @llvm.x86.avx2.pminu.w(<16 x i16> %a0, <16 x i16> %a1) + ret <16 x i16> %res +} +declare <16 x i16> @llvm.x86.avx2.pminu.w(<16 x i16>, <16 x i16>) nounwind readnone + +define <8 x i32> @mm256_min_epu32(<8 x i32> %a0, <8 x i32> %a1) { +; CHECK-LABEL: mm256_min_epu32: +; CHECK: ## BB#0: +; CHECK-NEXT: vpminud %ymm1, %ymm0, %ymm0 +; CHECK-NEXT: retl +; + %res = call <8 x i32> @llvm.x86.avx2.pminu.d(<8 x i32> %a0, <8 x i32> %a1) + ret <8 x i32> %res +} +declare <8 x i32> @llvm.x86.avx2.pminu.d(<8 x i32>, <8 x i32>) nounwind readnone + |

