[llvm] [SelectionDAG] Widen vector math libcalls when no routine is available (PR #218948)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 26 08:54:34 PDT 2026
================
@@ -112,5 +112,208 @@ define <vscale x 2 x double> @frem_strict_nxv2f64(<vscale x 2 x double> %unused,
ret <vscale x 2 x double> %res
}
+; Expected to be widened.
+define <2 x float> @frem_v2f32(<2 x float> %unused, <2 x float> %a, <2 x float> %b) #0 {
+; ARMPL-LABEL: frem_v2f32:
+; ARMPL: // %bb.0:
+; ARMPL-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
+; ARMPL-NEXT: .cfi_def_cfa_offset 16
+; ARMPL-NEXT: .cfi_offset w30, -16
+; ARMPL-NEXT: fmov d0, d1
+; ARMPL-NEXT: // kill: def $d2 killed $d2 def $q2
+; ARMPL-NEXT: mov v1.16b, v2.16b
+; ARMPL-NEXT: bl armpl_vfmodq_f32
----------------
david-arm wrote:
Will we also widen calls to pow(x, y), etc? When widening I think we should be careful to sanitise the inputs in the unused lanes. For example, in some cases the vector math variant of a call like pow(x,y) will take you down the slow path for handling infinity, -0.0, NaN, etc. That may be slower than doing two scalar calls! Or worse the call may generate an exception. For example, `mov v1.16b, v2.16b` looks potentially dangerous because we're not explicitly setting the top 64 bits to have sane 32-bit floats.
https://github.com/llvm/llvm-project/pull/218948
More information about the llvm-commits
mailing list