xref: /llvm-project/clang/test/CodeGenHLSL/builtins/log.hlsl (revision 762f1b17b2815ccdfb4e5cb5412cb6210db92f73)
1// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.3-library %s \
2// RUN:  -fnative-half-type -emit-llvm -disable-llvm-passes -o - | \
3// RUN:  FileCheck %s --check-prefixes=CHECK,NATIVE_HALF
4// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.3-library %s \
5// RUN:  -emit-llvm -disable-llvm-passes -o - | \
6// RUN:  FileCheck %s --check-prefixes=CHECK,NO_HALF
7
8// NATIVE_HALF-LABEL: define noundef nofpclass(nan inf) half @_Z13test_log_half
9// NATIVE_HALF: call reassoc nnan ninf nsz arcp afn half @llvm.log.f16(
10// NO_HALF-LABEL: define noundef nofpclass(nan inf) float @_Z13test_log_half
11// NO_HALF: call reassoc nnan ninf nsz arcp afn float @llvm.log.f32(
12half test_log_half(half p0) { return log(p0); }
13// NATIVE_HALF-LABEL: define noundef nofpclass(nan inf) <2 x half> @_Z14test_log_half2
14// NATIVE_HALF: call reassoc nnan ninf nsz arcp afn <2 x half> @llvm.log.v2f16
15// NO_HALF-LABEL: define noundef nofpclass(nan inf) <2 x float> @_Z14test_log_half2
16// NO_HALF: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.log.v2f32(
17half2 test_log_half2(half2 p0) { return log(p0); }
18// NATIVE_HALF-LABEL: define noundef nofpclass(nan inf) <3 x half> @_Z14test_log_half3
19// NATIVE_HALF: call reassoc nnan ninf nsz arcp afn <3 x half> @llvm.log.v3f16
20// NO_HALF-LABEL: define noundef nofpclass(nan inf) <3 x float> @_Z14test_log_half3
21// NO_HALF: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.log.v3f32(
22half3 test_log_half3(half3 p0) { return log(p0); }
23// NATIVE_HALF-LABEL: define noundef nofpclass(nan inf) <4 x half> @_Z14test_log_half4
24// NATIVE_HALF: call reassoc nnan ninf nsz arcp afn <4 x half> @llvm.log.v4f16
25// NO_HALF-LABEL: define noundef nofpclass(nan inf) <4 x float> @_Z14test_log_half4
26// NO_HALF: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.log.v4f32(
27half4 test_log_half4(half4 p0) { return log(p0); }
28
29// CHECK-LABEL: define noundef nofpclass(nan inf) float @_Z14test_log_float
30// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.log.f32(
31float test_log_float(float p0) { return log(p0); }
32// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> @_Z15test_log_float2
33// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.log.v2f32
34float2 test_log_float2(float2 p0) { return log(p0); }
35// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> @_Z15test_log_float3
36// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.log.v3f32
37float3 test_log_float3(float3 p0) { return log(p0); }
38// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> @_Z15test_log_float4
39// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.log.v4f32
40float4 test_log_float4(float4 p0) { return log(p0); }
41