-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[X86] Ensure that bit reversals of byte vectors are properly lowered on pure GFNI targets #148304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3a15c6a
Fix #148238
TDecking d4194ec
Update the test file
TDecking c097e12
Extend the optimization towards other vectors
TDecking 718deea
Turn SSSE2 into SSSE3
TDecking 4f27cd7
Formatting
TDecking aaf7f6d
Merge branch 'main' into bitrev
RKSimon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ | |
| ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512vl,+avx512bw | FileCheck %s --check-prefixes=ALL,AVX,AVX512,AVX512BW | ||
| ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+xop,+avx | FileCheck %s --check-prefixes=ALL,XOP,XOPAVX1 | ||
| ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+xop,+avx2 | FileCheck %s --check-prefixes=ALL,XOP,XOPAVX2 | ||
| ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+gfni | FileCheck %s --check-prefixes=ALL,GFNIPURE | ||
| ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+ssse3,+gfni | FileCheck %s --check-prefixes=ALL,GFNISSE | ||
|
||
| ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx,+gfni | FileCheck %s --check-prefixes=ALL,GFNIAVX,GFNIAVX1 | ||
| ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2,+gfni | FileCheck %s --check-prefixes=ALL,GFNIAVX,GFNIAVX2 | ||
|
|
@@ -60,13 +61,13 @@ define i8 @test_bitreverse_i8(i8 %a) nounwind { | |
| ; XOP-NEXT: # kill: def $al killed $al killed $eax | ||
| ; XOP-NEXT: retq | ||
| ; | ||
| ; GFNISSE-LABEL: test_bitreverse_i8: | ||
| ; GFNISSE: # %bb.0: | ||
| ; GFNISSE-NEXT: movd %edi, %xmm0 | ||
| ; GFNISSE-NEXT: gf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0 | ||
| ; GFNISSE-NEXT: movd %xmm0, %eax | ||
| ; GFNISSE-NEXT: # kill: def $al killed $al killed $eax | ||
| ; GFNISSE-NEXT: retq | ||
| ; GFNIPURE-LABEL: test_bitreverse_i8: | ||
| ; GFNIPURE: # %bb.0: | ||
| ; GFNIPURE-NEXT: movd %edi, %xmm0 | ||
| ; GFNIPURE-NEXT: gf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0 | ||
| ; GFNIPURE-NEXT: movd %xmm0, %eax | ||
| ; GFNIPURE-NEXT: # kill: def $al killed $al killed $eax | ||
| ; GFNIPURE-NEXT: retq | ||
| ; | ||
| ; GFNIAVX-LABEL: test_bitreverse_i8: | ||
| ; GFNIAVX: # %bb.0: | ||
|
|
@@ -134,14 +135,14 @@ define i16 @test_bitreverse_i16(i16 %a) nounwind { | |
| ; XOP-NEXT: # kill: def $ax killed $ax killed $eax | ||
| ; XOP-NEXT: retq | ||
| ; | ||
| ; GFNISSE-LABEL: test_bitreverse_i16: | ||
| ; GFNISSE: # %bb.0: | ||
| ; GFNISSE-NEXT: movd %edi, %xmm0 | ||
| ; GFNISSE-NEXT: gf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0 | ||
| ; GFNISSE-NEXT: movd %xmm0, %eax | ||
| ; GFNISSE-NEXT: rolw $8, %ax | ||
| ; GFNISSE-NEXT: # kill: def $ax killed $ax killed $eax | ||
| ; GFNISSE-NEXT: retq | ||
| ; GFNIPURE-LABEL: test_bitreverse_i16: | ||
| ; GFNIPURE: # %bb.0: | ||
| ; GFNIPURE-NEXT: movd %edi, %xmm0 | ||
| ; GFNIPURE-NEXT: gf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0 | ||
| ; GFNIPURE-NEXT: movd %xmm0, %eax | ||
| ; GFNIPURE-NEXT: rolw $8, %ax | ||
| ; GFNIPURE-NEXT: # kill: def $ax killed $ax killed $eax | ||
| ; GFNIPURE-NEXT: retq | ||
| ; | ||
| ; GFNIAVX-LABEL: test_bitreverse_i16: | ||
| ; GFNIAVX: # %bb.0: | ||
|
|
@@ -207,13 +208,13 @@ define i32 @test_bitreverse_i32(i32 %a) nounwind { | |
| ; XOP-NEXT: vmovd %xmm0, %eax | ||
| ; XOP-NEXT: retq | ||
| ; | ||
| ; GFNISSE-LABEL: test_bitreverse_i32: | ||
| ; GFNISSE: # %bb.0: | ||
| ; GFNISSE-NEXT: movd %edi, %xmm0 | ||
| ; GFNISSE-NEXT: gf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0 | ||
| ; GFNISSE-NEXT: movd %xmm0, %eax | ||
| ; GFNISSE-NEXT: bswapl %eax | ||
| ; GFNISSE-NEXT: retq | ||
| ; GFNIPURE-LABEL: test_bitreverse_i32: | ||
| ; GFNIPURE: # %bb.0: | ||
| ; GFNIPURE-NEXT: movd %edi, %xmm0 | ||
| ; GFNIPURE-NEXT: gf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0 | ||
| ; GFNIPURE-NEXT: movd %xmm0, %eax | ||
| ; GFNIPURE-NEXT: bswapl %eax | ||
| ; GFNIPURE-NEXT: retq | ||
| ; | ||
| ; GFNIAVX-LABEL: test_bitreverse_i32: | ||
| ; GFNIAVX: # %bb.0: | ||
|
|
@@ -282,13 +283,13 @@ define i64 @test_bitreverse_i64(i64 %a) nounwind { | |
| ; XOP-NEXT: vmovq %xmm0, %rax | ||
| ; XOP-NEXT: retq | ||
| ; | ||
| ; GFNISSE-LABEL: test_bitreverse_i64: | ||
| ; GFNISSE: # %bb.0: | ||
| ; GFNISSE-NEXT: movq %rdi, %xmm0 | ||
| ; GFNISSE-NEXT: gf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0 | ||
| ; GFNISSE-NEXT: movq %xmm0, %rax | ||
| ; GFNISSE-NEXT: bswapq %rax | ||
| ; GFNISSE-NEXT: retq | ||
| ; GFNIPURE-LABEL: test_bitreverse_i64: | ||
| ; GFNIPURE: # %bb.0: | ||
| ; GFNIPURE-NEXT: movq %rdi, %xmm0 | ||
| ; GFNIPURE-NEXT: gf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0 | ||
| ; GFNIPURE-NEXT: movq %xmm0, %rax | ||
| ; GFNIPURE-NEXT: bswapq %rax | ||
| ; GFNIPURE-NEXT: retq | ||
| ; | ||
| ; GFNIAVX-LABEL: test_bitreverse_i64: | ||
| ; GFNIAVX: # %bb.0: | ||
|
|
@@ -386,10 +387,10 @@ define <16 x i8> @test_bitreverse_v16i8(<16 x i8> %a) nounwind { | |
| ; XOP-NEXT: vpperm {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0, %xmm0 | ||
| ; XOP-NEXT: retq | ||
| ; | ||
| ; GFNISSE-LABEL: test_bitreverse_v16i8: | ||
| ; GFNISSE: # %bb.0: | ||
| ; GFNISSE-NEXT: gf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0 | ||
| ; GFNISSE-NEXT: retq | ||
| ; GFNIPURE-LABEL: test_bitreverse_v16i8: | ||
| ; GFNIPURE: # %bb.0: | ||
| ; GFNIPURE-NEXT: gf2p8affineqb $0, {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0 | ||
| ; GFNIPURE-NEXT: retq | ||
| ; | ||
| ; GFNIAVX-LABEL: test_bitreverse_v16i8: | ||
| ; GFNIAVX: # %bb.0: | ||
|
|
@@ -873,12 +874,12 @@ define <32 x i8> @test_bitreverse_v32i8(<32 x i8> %a) nounwind { | |
| ; XOPAVX2-NEXT: vinserti128 $1, %xmm1, %ymm0, %ymm0 | ||
| ; XOPAVX2-NEXT: retq | ||
| ; | ||
| ; GFNISSE-LABEL: test_bitreverse_v32i8: | ||
| ; GFNISSE: # %bb.0: | ||
| ; GFNISSE-NEXT: movdqa {{.*#+}} xmm2 = [1,2,4,8,16,32,64,128,1,2,4,8,16,32,64,128] | ||
| ; GFNISSE-NEXT: gf2p8affineqb $0, %xmm2, %xmm0 | ||
| ; GFNISSE-NEXT: gf2p8affineqb $0, %xmm2, %xmm1 | ||
| ; GFNISSE-NEXT: retq | ||
| ; GFNIPURE-LABEL: test_bitreverse_v32i8: | ||
| ; GFNIPURE: # %bb.0: | ||
| ; GFNIPURE-NEXT: movdqa {{.*#+}} xmm2 = [1,2,4,8,16,32,64,128,1,2,4,8,16,32,64,128] | ||
| ; GFNIPURE-NEXT: gf2p8affineqb $0, %xmm2, %xmm0 | ||
| ; GFNIPURE-NEXT: gf2p8affineqb $0, %xmm2, %xmm1 | ||
| ; GFNIPURE-NEXT: retq | ||
| ; | ||
| ; GFNIAVX-LABEL: test_bitreverse_v32i8: | ||
| ; GFNIAVX: # %bb.0: | ||
|
|
@@ -1724,14 +1725,14 @@ define <64 x i8> @test_bitreverse_v64i8(<64 x i8> %a) nounwind { | |
| ; XOPAVX2-NEXT: vinserti128 $1, %xmm2, %ymm1, %ymm1 | ||
| ; XOPAVX2-NEXT: retq | ||
| ; | ||
| ; GFNISSE-LABEL: test_bitreverse_v64i8: | ||
| ; GFNISSE: # %bb.0: | ||
| ; GFNISSE-NEXT: movdqa {{.*#+}} xmm4 = [1,2,4,8,16,32,64,128,1,2,4,8,16,32,64,128] | ||
| ; GFNISSE-NEXT: gf2p8affineqb $0, %xmm4, %xmm0 | ||
| ; GFNISSE-NEXT: gf2p8affineqb $0, %xmm4, %xmm1 | ||
| ; GFNISSE-NEXT: gf2p8affineqb $0, %xmm4, %xmm2 | ||
| ; GFNISSE-NEXT: gf2p8affineqb $0, %xmm4, %xmm3 | ||
| ; GFNISSE-NEXT: retq | ||
| ; GFNIPURE-LABEL: test_bitreverse_v64i8: | ||
| ; GFNIPURE: # %bb.0: | ||
| ; GFNIPURE-NEXT: movdqa {{.*#+}} xmm4 = [1,2,4,8,16,32,64,128,1,2,4,8,16,32,64,128] | ||
| ; GFNIPURE-NEXT: gf2p8affineqb $0, %xmm4, %xmm0 | ||
| ; GFNIPURE-NEXT: gf2p8affineqb $0, %xmm4, %xmm1 | ||
| ; GFNIPURE-NEXT: gf2p8affineqb $0, %xmm4, %xmm2 | ||
| ; GFNIPURE-NEXT: gf2p8affineqb $0, %xmm4, %xmm3 | ||
| ; GFNIPURE-NEXT: retq | ||
| ; | ||
| ; GFNIAVX1-LABEL: test_bitreverse_v64i8: | ||
| ; GFNIAVX1: # %bb.0: | ||
|
|
@@ -2849,6 +2850,11 @@ define <16 x i8> @fold_bitreverse_v16i8() nounwind { | |
| ; XOP-NEXT: vmovaps {{.*#+}} xmm0 = [0,255,64,191,32,223,96,159,16,239,80,175,48,207,112,143] | ||
| ; XOP-NEXT: retq | ||
| ; | ||
| ; GFNIPURE-LABEL: fold_bitreverse_v16i8: | ||
| ; GFNIPURE: # %bb.0: | ||
| ; GFNIPURE-NEXT: movaps {{.*#+}} xmm0 = [0,255,64,191,32,223,96,159,16,239,80,175,48,207,112,143] | ||
| ; GFNIPURE-NEXT: retq | ||
| ; | ||
| ; GFNISSE-LABEL: fold_bitreverse_v16i8: | ||
| ; GFNISSE: # %bb.0: | ||
| ; GFNISSE-NEXT: movaps {{.*#+}} xmm0 = [0,255,64,191,32,223,96,159,16,239,80,175,48,207,112,143] | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.