-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[X86] Support APX promoted RAO-INT and MOVBE instructions #77431
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 all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
2278af0
[X86] Surpport APX promoted RAO-INT and MOVBE instructions
XinWang10 0919f4d
add pattern to movberr
XinWang10 ba05382
update predicates
XinWang10 799d4d1
resolve comment
XinWang10 74f97e8
resolve comment
XinWang10 3c6cb40
rewrite with ITy
XinWang10 306a3c6
update test
XinWang10 a978e80
resolve comments
XinWang10 2f4b607
rewrite raoint multi class
XinWang10 9d0b8cb
support movberr to bswap
XinWang10 a881b3c
resolve comments
XinWang10 95148bc
add test for ndd,-movbe
XinWang10 2d2658b
reorder
XinWang10 42cbb58
use BinOpMR_M
XinWang10 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
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 |
---|---|---|
@@ -1,66 +1,230 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4 | ||
; RUN: llc -mtriple=x86_64-linux -mcpu=atom < %s | FileCheck %s | ||
; RUN: llc -mtriple=x86_64-linux -mcpu=slm < %s | FileCheck %s -check-prefix=SLM | ||
|
||
; RUN: llc -mtriple=x86_64-linux -mattr=+egpr,+ndd,+movbe --show-mc-encoding < %s | FileCheck %s -check-prefix=EGPR | ||
; RUN: llc -mtriple=x86_64-linux -mattr=+egpr,+ndd --show-mc-encoding < %s | FileCheck %s -check-prefix=NOMOVBE | ||
declare i16 @llvm.bswap.i16(i16) nounwind readnone | ||
declare i32 @llvm.bswap.i32(i32) nounwind readnone | ||
declare i64 @llvm.bswap.i64(i64) nounwind readnone | ||
|
||
define void @test1(ptr nocapture %x, i16 %y) nounwind { | ||
; CHECK-LABEL: test1: | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: movbew %si, (%rdi) | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: retq | ||
; | ||
; SLM-LABEL: test1: | ||
; SLM: # %bb.0: | ||
; SLM-NEXT: movbew %si, (%rdi) | ||
; SLM-NEXT: retq | ||
; | ||
; EGPR-LABEL: test1: | ||
; EGPR: # %bb.0: | ||
; EGPR-NEXT: movbew %si, (%rdi) # EVEX TO LEGACY Compression encoding: [0x66,0x0f,0x38,0xf1,0x37] | ||
; EGPR-NEXT: retq # encoding: [0xc3] | ||
; | ||
; NOMOVBE-LABEL: test1: | ||
; NOMOVBE: # %bb.0: | ||
; NOMOVBE-NEXT: rolw $8, %si, %ax # encoding: [0x62,0xf4,0x7d,0x18,0xc1,0xc6,0x08] | ||
; NOMOVBE-NEXT: movw %ax, (%rdi) # encoding: [0x66,0x89,0x07] | ||
; NOMOVBE-NEXT: retq # encoding: [0xc3] | ||
%bswap = call i16 @llvm.bswap.i16(i16 %y) | ||
store i16 %bswap, ptr %x, align 2 | ||
ret void | ||
; CHECK-LABEL: test1: | ||
; CHECK: movbew %si, (%rdi) | ||
; SLM-LABEL: test1: | ||
; SLM: movbew %si, (%rdi) | ||
} | ||
|
||
define i16 @test2(ptr %x) nounwind { | ||
; CHECK-LABEL: test2: | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: movbew (%rdi), %ax | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: retq | ||
; | ||
; SLM-LABEL: test2: | ||
; SLM: # %bb.0: | ||
; SLM-NEXT: movbew (%rdi), %ax | ||
; SLM-NEXT: retq | ||
; | ||
; EGPR-LABEL: test2: | ||
; EGPR: # %bb.0: | ||
; EGPR-NEXT: movbew (%rdi), %ax # EVEX TO LEGACY Compression encoding: [0x66,0x0f,0x38,0xf0,0x07] | ||
; EGPR-NEXT: retq # encoding: [0xc3] | ||
; | ||
; NOMOVBE-LABEL: test2: | ||
; NOMOVBE: # %bb.0: | ||
; NOMOVBE-NEXT: rolw $8, (%rdi), %ax # encoding: [0x62,0xf4,0x7d,0x18,0xc1,0x07,0x08] | ||
; NOMOVBE-NEXT: retq # encoding: [0xc3] | ||
%load = load i16, ptr %x, align 2 | ||
%bswap = call i16 @llvm.bswap.i16(i16 %load) | ||
ret i16 %bswap | ||
; CHECK-LABEL: test2: | ||
; CHECK: movbew (%rdi), %ax | ||
; SLM-LABEL: test2: | ||
; SLM: movbew (%rdi), %ax | ||
} | ||
|
||
define void @test3(ptr nocapture %x, i32 %y) nounwind { | ||
; CHECK-LABEL: test3: | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: movbel %esi, (%rdi) | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: retq | ||
; | ||
; SLM-LABEL: test3: | ||
; SLM: # %bb.0: | ||
; SLM-NEXT: movbel %esi, (%rdi) | ||
; SLM-NEXT: retq | ||
; | ||
; EGPR-LABEL: test3: | ||
; EGPR: # %bb.0: | ||
; EGPR-NEXT: movbel %esi, (%rdi) # EVEX TO LEGACY Compression encoding: [0x0f,0x38,0xf1,0x37] | ||
; EGPR-NEXT: retq # encoding: [0xc3] | ||
; | ||
; NOMOVBE-LABEL: test3: | ||
; NOMOVBE: # %bb.0: | ||
; NOMOVBE-NEXT: bswapl %esi # encoding: [0x0f,0xce] | ||
; NOMOVBE-NEXT: movl %esi, (%rdi) # encoding: [0x89,0x37] | ||
; NOMOVBE-NEXT: retq # encoding: [0xc3] | ||
%bswap = call i32 @llvm.bswap.i32(i32 %y) | ||
store i32 %bswap, ptr %x, align 4 | ||
ret void | ||
; CHECK-LABEL: test3: | ||
; CHECK: movbel %esi, (%rdi) | ||
; SLM-LABEL: test3: | ||
; SLM: movbel %esi, (%rdi) | ||
} | ||
|
||
define i32 @test4(ptr %x) nounwind { | ||
; CHECK-LABEL: test4: | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: movbel (%rdi), %eax | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: retq | ||
; | ||
; SLM-LABEL: test4: | ||
; SLM: # %bb.0: | ||
; SLM-NEXT: movbel (%rdi), %eax | ||
; SLM-NEXT: retq | ||
; | ||
; EGPR-LABEL: test4: | ||
; EGPR: # %bb.0: | ||
; EGPR-NEXT: movbel (%rdi), %eax # EVEX TO LEGACY Compression encoding: [0x0f,0x38,0xf0,0x07] | ||
; EGPR-NEXT: retq # encoding: [0xc3] | ||
; | ||
; NOMOVBE-LABEL: test4: | ||
; NOMOVBE: # %bb.0: | ||
; NOMOVBE-NEXT: movl (%rdi), %eax # encoding: [0x8b,0x07] | ||
; NOMOVBE-NEXT: bswapl %eax # encoding: [0x0f,0xc8] | ||
; NOMOVBE-NEXT: retq # encoding: [0xc3] | ||
%load = load i32, ptr %x, align 4 | ||
%bswap = call i32 @llvm.bswap.i32(i32 %load) | ||
ret i32 %bswap | ||
; CHECK-LABEL: test4: | ||
; CHECK: movbel (%rdi), %eax | ||
; SLM-LABEL: test4: | ||
; SLM: movbel (%rdi), %eax | ||
} | ||
|
||
define void @test5(ptr %x, i64 %y) nounwind { | ||
; CHECK-LABEL: test5: | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: movbeq %rsi, (%rdi) | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: retq | ||
; | ||
; SLM-LABEL: test5: | ||
; SLM: # %bb.0: | ||
; SLM-NEXT: movbeq %rsi, (%rdi) | ||
; SLM-NEXT: retq | ||
; | ||
; EGPR-LABEL: test5: | ||
; EGPR: # %bb.0: | ||
; EGPR-NEXT: movbeq %rsi, (%rdi) # EVEX TO LEGACY Compression encoding: [0x48,0x0f,0x38,0xf1,0x37] | ||
; EGPR-NEXT: retq # encoding: [0xc3] | ||
; | ||
; NOMOVBE-LABEL: test5: | ||
; NOMOVBE: # %bb.0: | ||
; NOMOVBE-NEXT: bswapq %rsi # encoding: [0x48,0x0f,0xce] | ||
; NOMOVBE-NEXT: movq %rsi, (%rdi) # encoding: [0x48,0x89,0x37] | ||
; NOMOVBE-NEXT: retq # encoding: [0xc3] | ||
%bswap = call i64 @llvm.bswap.i64(i64 %y) | ||
store i64 %bswap, ptr %x, align 8 | ||
ret void | ||
; CHECK-LABEL: test5: | ||
; CHECK: movbeq %rsi, (%rdi) | ||
; SLM-LABEL: test5: | ||
; SLM: movbeq %rsi, (%rdi) | ||
} | ||
|
||
define i64 @test6(ptr %x) nounwind { | ||
; CHECK-LABEL: test6: | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: movbeq (%rdi), %rax | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: retq | ||
; | ||
; SLM-LABEL: test6: | ||
; SLM: # %bb.0: | ||
; SLM-NEXT: movbeq (%rdi), %rax | ||
; SLM-NEXT: retq | ||
; | ||
; EGPR-LABEL: test6: | ||
; EGPR: # %bb.0: | ||
; EGPR-NEXT: movbeq (%rdi), %rax # EVEX TO LEGACY Compression encoding: [0x48,0x0f,0x38,0xf0,0x07] | ||
; EGPR-NEXT: retq # encoding: [0xc3] | ||
; | ||
; NOMOVBE-LABEL: test6: | ||
; NOMOVBE: # %bb.0: | ||
; NOMOVBE-NEXT: movq (%rdi), %rax # encoding: [0x48,0x8b,0x07] | ||
; NOMOVBE-NEXT: bswapq %rax # encoding: [0x48,0x0f,0xc8] | ||
; NOMOVBE-NEXT: retq # encoding: [0xc3] | ||
%load = load i64, ptr %x, align 8 | ||
%bswap = call i64 @llvm.bswap.i64(i64 %load) | ||
ret i64 %bswap | ||
; CHECK-LABEL: test6: | ||
; CHECK: movbeq (%rdi), %rax | ||
; SLM-LABEL: test6: | ||
; SLM: movbeq (%rdi), %rax | ||
} | ||
|
||
define i64 @test7(i64 %x) nounwind { | ||
; CHECK-LABEL: test7: | ||
; CHECK: # %bb.0: | ||
; CHECK-NEXT: movq %rdi, %rax | ||
; CHECK-NEXT: bswapq %rax | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: nop | ||
; CHECK-NEXT: retq | ||
; | ||
; SLM-LABEL: test7: | ||
; SLM: # %bb.0: | ||
; SLM-NEXT: movq %rdi, %rax | ||
; SLM-NEXT: bswapq %rax | ||
; SLM-NEXT: retq | ||
; | ||
; EGPR-LABEL: test7: | ||
; EGPR: # %bb.0: | ||
; EGPR-NEXT: movbeq %rdi, %rax # encoding: [0x62,0xf4,0xfc,0x08,0x61,0xf8] | ||
; EGPR-NEXT: retq # encoding: [0xc3] | ||
; | ||
; NOMOVBE-LABEL: test7: | ||
; NOMOVBE: # %bb.0: | ||
; NOMOVBE-NEXT: movq %rdi, %rax # encoding: [0x48,0x89,0xf8] | ||
; NOMOVBE-NEXT: bswapq %rax # encoding: [0x48,0x0f,0xc8] | ||
; NOMOVBE-NEXT: retq # encoding: [0xc3] | ||
%bswap = call i64 @llvm.bswap.i64(i64 %x) | ||
ret i64 %bswap | ||
} |
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.