-
Notifications
You must be signed in to change notification settings - Fork 13.7k
[X86] ICMP EQ/NE MIN_SIGNED_INT - avoid immediate argument by using NEG + SETO/SETNO #94948
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -783,8 +783,7 @@ define i32 @test_minsigned_i32(i32 %a0, i32 %a1) nounwind { | |
; X64-NEXT: movl %edi, %eax | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this will increase register pressure. Should we check one use of it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've been testing with hasOneUse but it isn't great as its purely down to final execution order - the abs tests can reuse the neg flag results in most cases. I'm going to see if X86FlagsCopyLowering can help us |
||
; X64-NEXT: negl %eax | ||
; X64-NEXT: cmovsl %edi, %eax | ||
; X64-NEXT: cmpl $-2147483648, %edi # imm = 0x80000000 | ||
; X64-NEXT: cmovel %esi, %eax | ||
; X64-NEXT: cmovol %esi, %eax | ||
; X64-NEXT: retq | ||
; | ||
; X86-LABEL: test_minsigned_i32: | ||
|
@@ -793,11 +792,7 @@ define i32 @test_minsigned_i32(i32 %a0, i32 %a1) nounwind { | |
; X86-NEXT: movl %ecx, %eax | ||
; X86-NEXT: negl %eax | ||
; X86-NEXT: cmovsl %ecx, %eax | ||
; X86-NEXT: cmpl $-2147483648, %ecx # imm = 0x80000000 | ||
; X86-NEXT: jne .LBB19_2 | ||
; X86-NEXT: # %bb.1: | ||
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax | ||
; X86-NEXT: .LBB19_2: | ||
; X86-NEXT: cmovol {{[0-9]+}}(%esp), %eax | ||
; X86-NEXT: retl | ||
%lim = icmp eq i32 %a0, -2147483648 | ||
%abs = tail call i32 @llvm.abs.i32(i32 %a0, i1 false) | ||
|
@@ -811,9 +806,7 @@ define i64 @test_minsigned_i64(i64 %a0, i64 %a1) nounwind { | |
; X64-NEXT: movq %rdi, %rax | ||
; X64-NEXT: negq %rax | ||
; X64-NEXT: cmovsq %rdi, %rax | ||
; X64-NEXT: movabsq $-9223372036854775808, %rcx # imm = 0x8000000000000000 | ||
; X64-NEXT: cmpq %rcx, %rdi | ||
; X64-NEXT: cmoveq %rsi, %rax | ||
; X64-NEXT: cmovoq %rsi, %rax | ||
; X64-NEXT: retq | ||
; | ||
; X86-LABEL: test_minsigned_i64: | ||
|
Uh oh!
There was an error while loading. Please reload this page.