Skip to content

Commit eb3fad5

Browse files
committed
Revert "[HLSL][clang] Add elementwise builtin for atan2 (p3) (llvm#110187)"
This reverts commit b70d327.
1 parent 8ddbd82 commit eb3fad5

18 files changed

+29
-195
lines changed

clang/docs/LanguageExtensions.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,6 @@ Unless specified otherwise operation(±0) = ±0 and operation(±infinity) = ±in
660660
T __builtin_elementwise_asin(T x) return the arcsine of x interpreted as an angle in radians floating point types
661661
T __builtin_elementwise_acos(T x) return the arccosine of x interpreted as an angle in radians floating point types
662662
T __builtin_elementwise_atan(T x) return the arctangent of x interpreted as an angle in radians floating point types
663-
T __builtin_elementwise_atan2(T y, T x) return the arctangent of y/x floating point types
664663
T __builtin_elementwise_sinh(T x) return the hyperbolic sine of angle x in radians floating point types
665664
T __builtin_elementwise_cosh(T x) return the hyperbolic cosine of angle x in radians floating point types
666665
T __builtin_elementwise_tanh(T x) return the hyperbolic tangent of angle x in radians floating point types

clang/docs/ReleaseNotes.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,8 +575,6 @@ DWARF Support in Clang
575575
Floating Point Support in Clang
576576
-------------------------------
577577

578-
- Add ``__builtin_elementwise_atan2`` builtin for floating point types only.
579-
580578
Fixed Point Support in Clang
581579
----------------------------
582580

clang/include/clang/Basic/Builtins.td

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,12 +1250,6 @@ def ElementwiseATan : Builtin {
12501250
let Prototype = "void(...)";
12511251
}
12521252

1253-
def ElementwiseATan2 : Builtin {
1254-
let Spellings = ["__builtin_elementwise_atan2"];
1255-
let Attributes = [NoThrow, Const, CustomTypeChecking];
1256-
let Prototype = "void(...)";
1257-
}
1258-
12591253
def ElementwiseBitreverse : Builtin {
12601254
let Spellings = ["__builtin_elementwise_bitreverse"];
12611255
let Attributes = [NoThrow, Const, CustomTypeChecking];

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3836,9 +3836,6 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
38363836
case Builtin::BI__builtin_elementwise_atan:
38373837
return RValue::get(emitBuiltinWithOneOverloadedType<1>(
38383838
*this, E, llvm::Intrinsic::atan, "elt.atan"));
3839-
case Builtin::BI__builtin_elementwise_atan2:
3840-
return RValue::get(emitBuiltinWithOneOverloadedType<2>(
3841-
*this, E, llvm::Intrinsic::atan2, "elt.atan2"));
38423839
case Builtin::BI__builtin_elementwise_ceil:
38433840
return RValue::get(emitBuiltinWithOneOverloadedType<1>(
38443841
*this, E, llvm::Intrinsic::ceil, "elt.ceil"));

clang/lib/Headers/hlsl/hlsl_intrinsics.h

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -466,36 +466,6 @@ float3 atan(float3);
466466
_HLSL_BUILTIN_ALIAS(__builtin_elementwise_atan)
467467
float4 atan(float4);
468468

469-
//===----------------------------------------------------------------------===//
470-
// atan2 builtins
471-
//===----------------------------------------------------------------------===//
472-
473-
/// \fn T atan2(T y, T x)
474-
/// \brief Returns the arctangent of y/x, using the signs of the arguments to
475-
/// determine the correct quadrant.
476-
/// \param y The y-coordinate.
477-
/// \param x The x-coordinate.
478-
479-
#ifdef __HLSL_ENABLE_16_BIT
480-
_HLSL_BUILTIN_ALIAS(__builtin_elementwise_atan2)
481-
half atan2(half y, half x);
482-
_HLSL_BUILTIN_ALIAS(__builtin_elementwise_atan2)
483-
half2 atan2(half2 y, half2 x);
484-
_HLSL_BUILTIN_ALIAS(__builtin_elementwise_atan2)
485-
half3 atan2(half3 y, half3 x);
486-
_HLSL_BUILTIN_ALIAS(__builtin_elementwise_atan2)
487-
half4 atan2(half4 y, half4 x);
488-
#endif
489-
490-
_HLSL_BUILTIN_ALIAS(__builtin_elementwise_atan2)
491-
float atan2(float y, float x);
492-
_HLSL_BUILTIN_ALIAS(__builtin_elementwise_atan2)
493-
float2 atan2(float2 y, float2 x);
494-
_HLSL_BUILTIN_ALIAS(__builtin_elementwise_atan2)
495-
float3 atan2(float3 y, float3 x);
496-
_HLSL_BUILTIN_ALIAS(__builtin_elementwise_atan2)
497-
float4 atan2(float4 y, float4 x);
498-
499469
//===----------------------------------------------------------------------===//
500470
// ceil builtins
501471
//===----------------------------------------------------------------------===//

clang/lib/Sema/SemaChecking.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2755,7 +2755,6 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
27552755

27562756
// These builtins restrict the element type to floating point
27572757
// types only, and take in two arguments.
2758-
case Builtin::BI__builtin_elementwise_atan2:
27592758
case Builtin::BI__builtin_elementwise_fmod:
27602759
case Builtin::BI__builtin_elementwise_pow: {
27612760
if (BuiltinElementwiseMath(TheCall))

clang/lib/Sema/SemaHLSL.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1959,7 +1959,6 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
19591959
case Builtin::BI__builtin_elementwise_acos:
19601960
case Builtin::BI__builtin_elementwise_asin:
19611961
case Builtin::BI__builtin_elementwise_atan:
1962-
case Builtin::BI__builtin_elementwise_atan2:
19631962
case Builtin::BI__builtin_elementwise_ceil:
19641963
case Builtin::BI__builtin_elementwise_cos:
19651964
case Builtin::BI__builtin_elementwise_cosh:

clang/test/CodeGen/builtins-elementwise-math.c

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -441,26 +441,6 @@ void test_builtin_elementwise_atan(float f1, float f2, double d1, double d2,
441441
vf2 = __builtin_elementwise_atan(vf1);
442442
}
443443

444-
void test_builtin_elementwise_atan2(float f1, float f2, float f3, double d1,
445-
double d2, double d3, float4 vf1,
446-
float4 vf2, float4 vf3) {
447-
// CHECK-LABEL: define void @test_builtin_elementwise_atan2(
448-
// CHECK: [[F1:%.+]] = load float, ptr %f1.addr, align 4
449-
// CHECK-NEXT: [[F2:%.+]] = load float, ptr %f2.addr, align 4
450-
// CHECK-NEXT: call float @llvm.atan2.f32(float [[F1]], float [[F2]])
451-
f3 = __builtin_elementwise_atan2(f1, f2);
452-
453-
// CHECK: [[D1:%.+]] = load double, ptr %d1.addr, align 8
454-
// CHECK-NEXT: [[D2:%.+]] = load double, ptr %d2.addr, align 8
455-
// CHECK-NEXT: call double @llvm.atan2.f64(double [[D1]], double [[D2]])
456-
d3 = __builtin_elementwise_atan2(d1, d2);
457-
458-
// CHECK: [[VF1:%.+]] = load <4 x float>, ptr %vf1.addr, align 16
459-
// CHECK-NEXT: [[VF2:%.+]] = load <4 x float>, ptr %vf2.addr, align 16
460-
// CHECK-NEXT: call <4 x float> @llvm.atan2.v4f32(<4 x float> [[VF1]], <4 x float> [[VF2]])
461-
vf3 = __builtin_elementwise_atan2(vf1, vf2);
462-
}
463-
464444
void test_builtin_elementwise_cos(float f1, float f2, double d1, double d2,
465445
float4 vf1, float4 vf2) {
466446
// CHECK-LABEL: define void @test_builtin_elementwise_cos(

clang/test/CodeGen/strictfp-elementwise-bulitins.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -257,16 +257,6 @@ float4 strict_elementwise_tanh(float4 a) {
257257
return __builtin_elementwise_tanh(a);
258258
}
259259

260-
// CHECK-LABEL: define dso_local noundef <4 x float> @_Z24strict_elementwise_atan2Dv4_fS_
261-
// CHECK-SAME: (<4 x float> noundef [[A:%.*]], <4 x float> noundef [[B:%.*]]) local_unnamed_addr #[[ATTR2]] {
262-
// CHECK-NEXT: entry:
263-
// CHECK-NEXT: [[ELT_ATAN2:%.*]] = tail call <4 x float> @llvm.atan2.v4f32(<4 x float> [[A]], <4 x float> [[B]]) #[[ATTR4]]
264-
// CHECK-NEXT: ret <4 x float> [[ELT_ATAN2]]
265-
//
266-
float4 strict_elementwise_atan2(float4 a, float4 b) {
267-
return __builtin_elementwise_atan2(a, b);
268-
}
269-
270260
// CHECK-LABEL: define dso_local noundef <4 x float> @_Z24strict_elementwise_truncDv4_f
271261
// CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
272262
// CHECK-NEXT: entry:

clang/test/CodeGenHLSL/builtins/atan2.hlsl

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)