From 37142847faaac9ebf67858aeca9166d161b0c9c8 Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Tue, 16 Feb 2021 10:14:37 -0800 Subject: [PATCH] microsoft/clc: Add test with inline function Reviewed-by: Karol Herbst Part-of: --- src/microsoft/clc/clc_compiler_test.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/microsoft/clc/clc_compiler_test.cpp b/src/microsoft/clc/clc_compiler_test.cpp index d38861434ad..c2cd762c6a0 100644 --- a/src/microsoft/clc/clc_compiler_test.cpp +++ b/src/microsoft/clc/clc_compiler_test.cpp @@ -2186,3 +2186,21 @@ TEST_F(ComputeTest, vstore_half) for (unsigned i = 0; i < 8; ++i) EXPECT_EQ(dest[i], expected[i]); } + +TEST_F(ComputeTest, inline_function) +{ + const char *kernel_source = R"( + inline float helper(float foo) + { + return foo * 2; + } + + __kernel void main_test(__global float *dst, __global float *src) + { + *dst = helper(*src); + })"; + auto dest = ShaderArg({ NAN }, SHADER_ARG_OUTPUT); + auto src = ShaderArg({ 1.0f }, SHADER_ARG_INPUT); + run_shader(kernel_source, 1, 1, 1, dest, src); + EXPECT_EQ(dest[0], 2.0f); +}