[clang] [llvm] [InstCombine] Combine llvm.sin/llvm.cos libcall pairs into llvm.sincos (PR #184760)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 8 05:09:04 PDT 2026


================
@@ -99,3 +93,18 @@ void test_half_builtins(half h0, half h1, half h2, int i0) {
   // CHECK: call half @llvm.ldexp.f16.i32(half %h0, i32 %i0)
   res = __builtin_ldexpf16(h0, i0);
 }
+
+// sin and cos are split into separate functions to avoid sincos combining.
+// CHECK-LABEL: define{{.*}} void @test_half_sin
+// CHECK: call half @llvm.sin.f16(half %h0)
+void test_half_sin(half h0) {
+  volatile half res;
+  res = __builtin_sinf16(h0);
----------------
arsenm wrote:

Return the value instead of store to volatile? 

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


More information about the cfe-commits mailing list