[llvm] [X86][SelectionDAG] - Extend dag combiner to handle pow(1.5f), pow(x,2/3f) (PR #214202)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 7 07:06:38 PDT 2026


================
@@ -109,6 +109,70 @@ define float @powf_libcall_negthird_fast(float %x) {
   ret float %pow
 }
 
+; pow(X, 2/3) --> cbrt(X) * cbrt(X) when { nnan ninf nsz afn } is present.
+
+define double @pow_intrinsic_twothirds_fast(double %x) {
+; CHECK-LABEL: @pow_intrinsic_twothirds_fast(
+; CHECK-NEXT:    [[CBRT:%.*]] = call fast double @cbrt(double [[X:%.*]])
+; CHECK-NEXT:    [[POW:%.*]] = fmul fast double [[CBRT]], [[CBRT]]
+; CHECK-NEXT:    ret double [[POW]]
+;
+  %pow = call fast double @llvm.pow.f64(double %x, double 0x3fe5555555555555)
----------------
arsenm wrote:

test with minimum flags required for transform, and separately other flag preservation 

https://github.com/llvm/llvm-project/pull/214202


More information about the llvm-commits mailing list