Skip to content

Commit f46b600

Browse files
committed
Addressed feedback: No longer checking type in CG: it's already checked in sema; Added radians to half and float only test
1 parent 316d08a commit f46b600

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18879,11 +18879,12 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: {
1887918879
}
1888018880
case Builtin::BI__builtin_hlsl_elementwise_radians: {
1888118881
Value *Op0 = EmitScalarExpr(E->getArg(0));
18882-
if (!E->getArg(0)->getType()->hasFloatingRepresentation())
18883-
llvm_unreachable("radians operand must have a float representation");
18882+
assert(E->getArg(0)->getType()->hasFloatingRepresentation() &&
18883+
"radians operand must have a float representation");
1888418884
return Builder.CreateIntrinsic(
18885-
/*ReturnType=*/Op0->getType(), CGM.getHLSLRuntime().getRadiansIntrinsic(),
18886-
ArrayRef<Value *>{Op0}, nullptr, "hlsl.radians");
18885+
/*ReturnType=*/Op0->getType(),
18886+
CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef<Value *>{Op0},
18887+
nullptr, "hlsl.radians");
1888718888
}
1888818889
}
1888918890
return nullptr;

clang/test/SemaHLSL/BuiltIns/half-float-only-errors.hlsl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_tan
1818
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_tanh
1919
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_trunc
20+
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_radians
2021

2122
double test_double_builtin(double p0) {
2223
return TEST_FUNC(p0);

0 commit comments

Comments
 (0)