[all-commits] [llvm/llvm-project] 491652: [X86] Replace (31/63 -/^ X) with (NOT X) and ignor...
goldsteinn via All-commits
all-commits at lists.llvm.org
Thu Jan 12 20:54:14 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 4916523053d791e17d1cc2135f7a14de16ed1dcc
https://github.com/llvm/llvm-project/commit/4916523053d791e17d1cc2135f7a14de16ed1dcc
Author: Noah Goldstein <goldstein.w.n at gmail.com>
Date: 2023-01-12 (Thu, 12 Jan 2023)
Changed paths:
M llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
M llvm/test/CodeGen/X86/legalize-shift-64.ll
M llvm/test/CodeGen/X86/not-shift.ll
Log Message:
-----------
[X86] Replace (31/63 -/^ X) with (NOT X) and ignore (32/64 ^ X) when computing shift count
Shift count is masked by hardware so these peepholes just extend
common patterns for NOT to the lower bits of shift count.
As well (32/64 ^ X) is masked off by the shift so can be safely
ignored.
Reviewed By: pengfei, lebedev.ri
Differential Revision: https://reviews.llvm.org/D140087
Commit: 4196ca3278f78c6e19246e54ab0ecb364e37d66a
https://github.com/llvm/llvm-project/commit/4196ca3278f78c6e19246e54ab0ecb364e37d66a
Author: Noah Goldstein <goldstein.w.n at gmail.com>
Date: 2023-01-12 (Thu, 12 Jan 2023)
Changed paths:
M llvm/lib/Target/X86/X86ISelLowering.cpp
M llvm/test/CodeGen/X86/mul-constant-i16.ll
M llvm/test/CodeGen/X86/mul-constant-i32.ll
M llvm/test/CodeGen/X86/mul-constant-i64.ll
M llvm/test/CodeGen/X86/mul-constant-i8.ll
M llvm/test/CodeGen/X86/mul-constant-result.ll
Log Message:
-----------
[X86] Improve mul x, 2^N +/- 2 pattern by making the +/- 2x compute independently to x << N
Previous pattern was omitting ops in sequence which just increases the
latency (to 3c, same as imul!) i.e:
`(add/sub (add/sub (shl x, N), x), x)`
Better is to compute 2x indepedently so x << N for better ULP i.e:
`(add/sub (shl x, N), (add x, x))`
Reviewed By: pengfei, RKSimon
Differential Revision: https://reviews.llvm.org/D141113
Compare: https://github.com/llvm/llvm-project/compare/371884865393...4196ca3278f7
More information about the All-commits
mailing list