[clang] [llvm] [HLSL][DXIL] Implement `refract` intrinsic (PR #147342)

Sarah Spall via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 14 11:33:31 PDT 2025


================
@@ -21,3 +24,18 @@ float test_int_scalar_inputs(int p0, int p1, int p2) {
   return __builtin_spirv_refract(p0, p1, p2);
   //  expected-error at -1 {{1st argument must be a scalar or vector of 16 or 32 bit floating-point types (was 'int')}}
 }
+
+float test_float_and_half_inputs(float2 p0, half2 p1, float p2) {
+  return __builtin_spirv_refract(p0, p1, p2);
+  //  expected-error at -1 {{2nd argument must be a scalar or vector of 16 or 32 bit floating-point types (was 'half2' (vector of 2 'half' values))}}
+}
+
+float test_float_and_half_2_inputs(float2 p0, float2 p1, half p2) {
+  return __builtin_spirv_refract(p0, p1, p2);
+  //  expected-error at -1 {{3rd argument must be a scalar 16 or 32 bit floating-point type (was 'half' (aka '_Float16'))}}
----------------
spall wrote:

This error message doesn't look correct either. I'd expect a message like
```
all arguments to __builtin_spirv_refract must be of scalar or fector type with matching scalar element type: float vs half
```

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


More information about the llvm-commits mailing list