| 1 |
// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu \ |
| 2 |
// RUN: -target-feature +altivec -ast-dump \ |
| 3 |
// RUN: -xc++ < %s \ |
| 4 |
// RUN: | FileCheck %s |
| 5 |
|
| 6 |
// Ensures that casts to AltiVec type with a dependent expression operand does |
| 7 |
// not hit the assertion failure reported in PR47676. Further checks that casts |
| 8 |
// to AltiVec type with a dependent expression operand is, on instantiation, |
| 9 |
// able to correctly differentiate between a splat case and a bitcast case. |
| 10 |
template <typename T> void f(T *tp) { |
| 11 |
extern void g(int, ...); |
| 12 |
g(0, (__vector int)(*tp)); |
| 13 |
g(0, (__vector int)*tp); |
| 14 |
} |
| 15 |
|
| 16 |
void g(void) { |
| 17 |
f<__vector float>(nullptr); |
| 18 |
// CHECK: | |-FunctionDecl {{.*}} f 'void (__vector float *)' |
| 19 |
|
| 20 |
// CHECK: | | `-CStyleCastExpr {{.*}} '__vector int' <NoOp> |
| 21 |
// CHECK-NEXT: | | `-ImplicitCastExpr {{.*}} '__vector int' <BitCast> |
| 22 |
// CHECK-NEXT: | | `-ImplicitCastExpr {{.*}}'__vector float' <LValueToRValue> |
| 23 |
|
| 24 |
// CHECK: | `-CStyleCastExpr {{.*}} '__vector int' <NoOp> |
| 25 |
// CHECK-NEXT: | `-ImplicitCastExpr {{.*}} '__vector int' <BitCast> |
| 26 |
// CHECK-NEXT: | `-ImplicitCastExpr {{.*}}'__vector float' <LValueToRValue> |
| 27 |
|
| 28 |
f<double>(nullptr); |
| 29 |
// CHECK: | `-FunctionDecl {{.*}} f 'void (double *)' |
| 30 |
|
| 31 |
// CHECK: | | `-CStyleCastExpr {{.*}} '__vector int' <VectorSplat> |
| 32 |
// CHECK-NEXT: | | `-ImplicitCastExpr {{.*}} 'int' <FloatingToIntegral> |
| 33 |
// CHECK-NEXT: | | `-ImplicitCastExpr {{.*}}'double' <LValueToRValue> |
| 34 |
|
| 35 |
// CHECK: | `-CStyleCastExpr {{.*}} '__vector int' <VectorSplat> |
| 36 |
// CHECK-NEXT: | `-ImplicitCastExpr {{.*}} 'int' <FloatingToIntegral> |
| 37 |
// CHECK-NEXT: | `-ImplicitCastExpr {{.*}}'double' <LValueToRValue> |
| 38 |
} |