[PATCH] D139363: [SDAG] try to convert bit set/clear to signbit test when trunc is free
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 6 07:05:50 PST 2022
spatel marked 3 inline comments as done.
spatel added inline comments.
================
Comment at: llvm/test/CodeGen/X86/is_fpclass-fp80.ll:65-66
; CHECK-64-NEXT: setl %dl
-; CHECK-64-NEXT: shrq $63, %rcx
+; CHECK-64-NEXT: testq %rcx, %rcx
+; CHECK-64-NEXT: sets %cl
; CHECK-64-NEXT: testq %rax, %rax
----------------
MatzeB wrote:
> I wonder if this is better or worse than before...
I looked closer at the debug spew on this test. It is not dependent on the fact that the top bit is masked (and so the trunc disappears). Before legalization, we actually are shrinking from an i80 to i64.
So we can make this patch more focused by predicating on a legal source type, and that avoids the regression (I count this as a small regression because it needs an extra instruction even if it's likely cheap).
The pattern where the top bit is masked seems to be transformed independently of this patch for x86 at least, so we might want a follow-up patch to deal with that pattern specifically.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139363/new/
https://reviews.llvm.org/D139363
More information about the llvm-commits
mailing list