Skip to content

Commit 3ab305e

Browse files
committed
Fixups
1 parent 7210b51 commit 3ab305e

File tree

3 files changed

+34
-44
lines changed

3 files changed

+34
-44
lines changed

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3270,8 +3270,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
32703270
case Builtin::BI__builtin_sincos:
32713271
case Builtin::BI__builtin_sincosf:
32723272
case Builtin::BI__builtin_sincosl:
3273-
case Builtin::BI__builtin_sincosf128:
3274-
case Builtin::BI__builtin_sincosf16:
3273+
if (!getTarget().getTriple().isAArch64())
3274+
break;
32753275
emitSincosBuiltin(*this, E, Intrinsic::sincos);
32763276
return RValue::get(nullptr);
32773277

clang/test/CodeGen/AArch64/sincos.c

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,46 @@
33

44
void sincos(double, double*, double*);
55
void sincosf(float, float*, float*);
6+
void sincosl(long double, long double*, long double*);
67

7-
// NO-MATH-ERRNO-LABEL: @foo
8+
// NO-MATH-ERRNO-LABEL: @sincos_f32
9+
// NO-MATH-ERRNO: [[SINCOS:%.*]] = call { float, float } @llvm.sincos.f32(float {{.*}})
10+
// NO-MATH-ERRNO-NEXT: [[SIN:%.*]] = extractvalue { float, float } [[SINCOS]], 0
11+
// NO-MATH-ERRNO-NEXT: [[COS:%.*]] = extractvalue { float, float } [[SINCOS]], 1
12+
// NO-MATH-ERRNO-NEXT: store float [[SIN]], ptr {{.*}}, align 4, !alias.scope [[SINCOS_ALIAS_SCOPE:![0-9]+]]
13+
// NO-MATH-ERRNO-NEXT: store float [[COS]], ptr {{.*}}, align 4, !noalias [[SINCOS_ALIAS_SCOPE]]
14+
//
15+
// MATH-ERRNO-LABEL: @sincos_f32
16+
// MATH-ERRNO: call void @sincosf(
17+
//
18+
void sincos_f32(float x, float* fp0, float* fp1) {
19+
sincosf(x, fp0, fp1);
20+
}
21+
22+
// NO-MATH-ERRNO-LABEL: @sincos_f64
823
// NO-MATH-ERRNO: [[SINCOS:%.*]] = call { double, double } @llvm.sincos.f64(double {{.*}})
924
// NO-MATH-ERRNO-NEXT: [[SIN:%.*]] = extractvalue { double, double } [[SINCOS]], 0
1025
// NO-MATH-ERRNO-NEXT: [[COS:%.*]] = extractvalue { double, double } [[SINCOS]], 1
1126
// NO-MATH-ERRNO-NEXT: store double [[SIN]], ptr {{.*}}, align 8, !alias.scope [[SINCOS_ALIAS_SCOPE:![0-9]+]]
1227
// NO-MATH-ERRNO-NEXT: store double [[COS]], ptr {{.*}}, align 8, !noalias [[SINCOS_ALIAS_SCOPE]]
1328
//
14-
// MATH-ERRNO-LABEL: @foo
29+
// MATH-ERRNO-LABEL: @sincos_f64
1530
// MATH-ERRNO: call void @sincos(
1631
//
17-
void foo(double x, double* dp0, double* dp1) {
32+
void sincos_f64(double x, double* dp0, double* dp1) {
1833
sincos(x, dp0, dp1);
1934
}
2035

21-
// NO-MATH-ERRNO-LABEL: @bar
22-
// NO-MATH-ERRNO: [[SINCOS:%.*]] = call { float, float } @llvm.sincos.f32(float {{.*}})
23-
// NO-MATH-ERRNO-NEXT: [[SIN:%.*]] = extractvalue { float, float } [[SINCOS]], 0
24-
// NO-MATH-ERRNO-NEXT: [[COS:%.*]] = extractvalue { float, float } [[SINCOS]], 1
25-
// NO-MATH-ERRNO-NEXT: store float [[SIN]], ptr {{.*}}, align 4, !alias.scope [[SINCOS_ALIAS_SCOPE:![0-9]+]]
26-
// NO-MATH-ERRNO-NEXT: store float [[COS]], ptr {{.*}}, align 4, !noalias [[SINCOS_ALIAS_SCOPE]]
36+
// NO-MATH-ERRNO-LABEL: @sincos_f128
37+
// NO-MATH-ERRNO: [[SINCOS:%.*]] = call { fp128, fp128 } @llvm.sincos.f128(fp128 {{.*}})
38+
// NO-MATH-ERRNO-NEXT: [[SIN:%.*]] = extractvalue { fp128, fp128 } [[SINCOS]], 0
39+
// NO-MATH-ERRNO-NEXT: [[COS:%.*]] = extractvalue { fp128, fp128 } [[SINCOS]], 1
40+
// NO-MATH-ERRNO-NEXT: store fp128 [[SIN]], ptr {{.*}}, align 16, !alias.scope [[SINCOS_ALIAS_SCOPE:![0-9]+]]
41+
// NO-MATH-ERRNO-NEXT: store fp128 [[COS]], ptr {{.*}}, align 16, !noalias [[SINCOS_ALIAS_SCOPE]]
2742
//
28-
// MATH-ERRNO-LABEL: @bar
29-
// MATH-ERRNO: call void @sincosf(
43+
// MATH-ERRNO-LABEL: @sincos_f128
44+
// MATH-ERRNO: call void @sincosl(
3045
//
31-
void bar(float x, float* fp0, float* fp1) {
32-
sincosf(x, fp0, fp1);
46+
void sincos_f128(long double x, long double* ldp0, long double* ldp1) {
47+
sincosl(x, ldp0, ldp1);
3348
}

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

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -38,31 +38,6 @@ void foo(double *d, float f, float *fp, long double *l, int *i, const char *c) {
3838
// NO__ERRNO-NEXT: [[FREXP_F128_0:%.+]] = extractvalue { fp128, i32 } [[FREXP_F128]], 0
3939

4040

41-
// NO__ERRNO: [[SINCOS_F64:%.+]] = call { double, double } @llvm.sincos.f64(double %{{.+}})
42-
// NO__ERRNO-NEXT: [[SINCOS_F64_0:%.+]] = extractvalue { double, double } [[SINCOS_F64]], 0
43-
// NO__ERRNO-NEXT: [[SINCOS_F64_1:%.+]] = extractvalue { double, double } [[SINCOS_F64]], 1
44-
// NO__ERRNO-NEXT: store double [[SINCOS_F64_0]], ptr %{{.+}}, align 8
45-
// NO__ERRNO-NEXT: store double [[SINCOS_F64_1]], ptr %{{.+}}, align 8
46-
47-
// NO__ERRNO: [[SINCOS_F32:%.+]] = call { float, float } @llvm.sincos.f32(float %{{.+}})
48-
// NO__ERRNO-NEXT: [[SINCOS_F32_0:%.+]] = extractvalue { float, float } [[SINCOS_F32]], 0
49-
// NO__ERRNO-NEXT: [[SINCOS_F32_1:%.+]] = extractvalue { float, float } [[SINCOS_F32]], 1
50-
// NO__ERRNO-NEXT: store float [[SINCOS_F32_0]], ptr %{{.+}}, align 4
51-
// NO__ERRNO-NEXT: store float [[SINCOS_F32_1]], ptr %{{.+}}, align 4
52-
53-
// NO__ERRNO: [[SINCOS_F80:%.+]] = call { x86_fp80, x86_fp80 } @llvm.sincos.f80(x86_fp80 %{{.+}})
54-
// NO__ERRNO-NEXT: [[SINCOS_F80_0:%.+]] = extractvalue { x86_fp80, x86_fp80 } [[SINCOS_F80]], 0
55-
// NO__ERRNO-NEXT: [[SINCOS_F80_1:%.+]] = extractvalue { x86_fp80, x86_fp80 } [[SINCOS_F80]], 1
56-
// NO__ERRNO-NEXT: store x86_fp80 [[SINCOS_F80_0]], ptr %{{.+}}, align 16
57-
// NO__ERRNO-NEXT: store x86_fp80 [[SINCOS_F80_1]], ptr %{{.+}}, align 16
58-
59-
// NO__ERRNO: [[SINCOS_F128:%.+]] = call { fp128, fp128 } @llvm.sincos.f128(fp128 %{{.+}})
60-
// NO__ERRNO-NEXT: [[SINCOS_F128_0:%.+]] = extractvalue { fp128, fp128 } [[SINCOS_F128]], 0
61-
// NO__ERRNO-NEXT: [[SINCOS_F128_1:%.+]] = extractvalue { fp128, fp128 } [[SINCOS_F128]], 1
62-
// NO__ERRNO-NEXT: store fp128 [[SINCOS_F128_0]], ptr %{{.+}}, align 16
63-
// NO__ERRNO-NEXT: store fp128 [[SINCOS_F128_1]], ptr %{{.+}}, align 16
64-
65-
6641
// HAS_ERRNO: declare double @fmod(double noundef, double noundef) [[NOT_READNONE:#[0-9]+]]
6742
// HAS_ERRNO: declare float @fmodf(float noundef, float noundef) [[NOT_READNONE]]
6843
// HAS_ERRNO: declare x86_fp80 @fmodl(x86_fp80 noundef, x86_fp80 noundef) [[NOT_READNONE]]
@@ -691,10 +666,10 @@ __builtin_sinh(f); __builtin_sinhf(f); __builtin_sinhl(f); __builtin_
691666
// HAS_ERRNO: declare fp128 @sinhf128(fp128 noundef) [[NOT_READNONE]]
692667

693668
__builtin_sincos(f,d,d); __builtin_sincosf(f,fp,fp); __builtin_sincosl(f,l,l); __builtin_sincosf128(f,l,l);
694-
// NO__ERRNO: declare { double, double } @llvm.sincos.f64(double) [[READNONE_INTRINSIC]]
695-
// NO__ERRNO: declare { float, float } @llvm.sincos.f32(float) [[READNONE_INTRINSIC]]
696-
// NO__ERRNO: declare { x86_fp80, x86_fp80 } @llvm.sincos.f80(x86_fp80) [[READNONE_INTRINSIC]]
697-
// NO__ERRNO: declare { fp128, fp128 } @llvm.sincos.f128(fp128) [[READNONE_INTRINSIC]]
669+
// NO__ERRNO: declare void @sincos(double noundef, ptr noundef, ptr noundef) [[NOT_READNONE]]
670+
// NO__ERRNO: declare void @sincosf(float noundef, ptr noundef, ptr noundef) [[NOT_READNONE]]
671+
// NO__ERRNO: declare void @sincosl(x86_fp80 noundef, ptr noundef, ptr noundef) [[NOT_READNONE]]
672+
// NO__ERRNO: declare void @sincosf128(fp128 noundef, ptr noundef, ptr noundef) [[NOT_READNONE]]
698673
// HAS_ERRNO: declare void @sincos(double noundef, ptr noundef, ptr noundef) [[NOT_READNONE]]
699674
// HAS_ERRNO: declare void @sincosf(float noundef, ptr noundef, ptr noundef) [[NOT_READNONE]]
700675
// HAS_ERRNO: declare void @sincosl(x86_fp80 noundef, ptr noundef, ptr noundef) [[NOT_READNONE]]

0 commit comments

Comments
 (0)