[llvm] [AMDGPU] Fix canonicalization of truncated values. (PR #83054)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 6 03:01:58 PST 2024
================
@@ -2944,6 +2944,34 @@ def : GCNPat<
(V_BFREV_B32_e64 (i32 (EXTRACT_SUBREG VReg_64:$a, sub1))), sub0,
(V_BFREV_B32_e64 (i32 (EXTRACT_SUBREG VReg_64:$a, sub0))), sub1)>;
+// If fcanonicalize's operand is implicitly canonicalized, we only need a copy.
+let AddedComplexity = 1000 in {
+def : GCNPat<
+ (is_canonicalized_1<fcanonicalize> f16:$src),
----------------
jayfoad wrote:
This might be a dumb question (I have never understood DAG selection patterns) but why can't we write this more like `(fcanonicalize (is_canonicalized f16:$src))`, so the predicate applies to the operand instead of to the whole expression? Then we would not need separate `_1` and `_2` versions of `is_canonicalized`.
https://github.com/llvm/llvm-project/pull/83054
More information about the llvm-commits
mailing list