diff --git a/clang/lib/Sema/OpenCLBuiltins.td b/clang/lib/Sema/OpenCLBuiltins.td index f2a9b98196e85..05dd6a1bd8f84 100644 --- a/clang/lib/Sema/OpenCLBuiltins.td +++ b/clang/lib/Sema/OpenCLBuiltins.td @@ -651,12 +651,18 @@ foreach name = ["step"] in { } // --- 3 arguments --- -foreach name = ["clamp", "mix"] in { +foreach name = ["clamp"] in { def : Builtin; def : Builtin; def : Builtin; def : Builtin; } +foreach name = ["mix"] in { + def : Builtin; + def : Builtin; + def : Builtin; + def : Builtin; +} foreach name = ["smoothstep"] in { def : Builtin; def : Builtin; diff --git a/clang/test/CodeGenOpenCL/fdeclare-opencl-builtins.cl b/clang/test/CodeGenOpenCL/fdeclare-opencl-builtins.cl index e4f4db0cd174f..a59357e331e77 100644 --- a/clang/test/CodeGenOpenCL/fdeclare-opencl-builtins.cl +++ b/clang/test/CodeGenOpenCL/fdeclare-opencl-builtins.cl @@ -1,5 +1,13 @@ // RUN: %clang_cc1 -emit-llvm -o - -O0 -triple spir-unknown-unknown -cl-std=CL1.2 -fdeclare-opencl-builtins -finclude-default-header %s | FileCheck %s +// Test that mix is correctly defined. +// CHECK-LABEL: @test_float +// CHECK: call <4 x float> @_Z3mixDv4_fS_f +// CHECK: ret +void test_float(float4 x, float a) { + float4 ret = mix(x, x, a); +} + // Test that Attr.Const from OpenCLBuiltins.td is lowered to a readnone attribute. // CHECK-LABEL: @test_const_attr // CHECK: call i32 @_Z3maxii({{.*}}) [[ATTR_CONST:#[0-9]]]