brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.7 KiB · eb468bd Raw
124 lines · plain
1// RUN: %clang_cc1 -verify -DMAC -triple=i686-apple-macosx10.10 -Wno-objc-root-class %s2// RUN: %clang_cc1 -verify -DMAC -triple=i686-apple-macosx10.4 -Wno-objc-root-class %s3// RUN: %clang_cc1 -verify -DMAC -triple=i686-apple-darwin14 -Wno-objc-root-class %s4// RUN: %clang_cc1 -verify -triple=i686-apple-ios8 -Wno-objc-root-class %s5 6// RUN: %clang_cc1 -verify -DALLOW -DMAC -triple=i686-apple-macosx10.11 -Wno-objc-root-class %s7// RUN: %clang_cc1 -verify -DALLOW -DMAC -triple=i686-apple-darwin15 -Wno-objc-root-class %s8// RUN: %clang_cc1 -verify -DALLOW -DIOS -triple=i686-apple-ios9 -Wno-objc-root-class %s9// RUN: %clang_cc1 -verify -DALLOW -DOTHER -triple=i686-apple-watchos -Wno-objc-root-class %s10// RUN: %clang_cc1 -verify -DALLOW -DOTHER -triple=i686-apple-tvos -Wno-objc-root-class %s11 12// RUN: %clang_cc1 -verify -DALLOW -DOTHER -triple=x86_64-apple-macosx10.10 -Wno-objc-root-class %s13 14typedef __attribute__((__ext_vector_type__(3))) float float3;15 16typedef float __m128 __attribute__((__vector_size__(16)));17 18struct Aggregate { __m128 v; };19struct AggregateFloat { float v; };20 21#define AVAILABLE_MACOS_10_10 __attribute__((availability(macos, introduced = 10.10)))22#define AVAILABLE_MACOS_10_11 __attribute__((availability(macos, introduced = 10.11)))23 24#define AVAILABLE_IOS_8 __attribute__((availability(ios, introduced = 8.0)))25#define AVAILABLE_IOS_9 __attribute__((availability(ios, introduced = 9.0)))26 27@interface VectorMethods28 29-(void)takeVector:(float3)v; // there should be no diagnostic at declaration30-(void)takeM128:(__m128)v;31 32@end33 34@implementation VectorMethods35 36#ifndef ALLOW37 38-(void)takeVector:(float3)v {39#ifdef MAC40  // expected-error@-2 {{'float3' (vector of 3 'float' values) parameter type is unsupported; support for vector types for this target is introduced in macOS 10.11}}41#else42  // expected-error@-4 {{'float3' (vector of 3 'float' values) parameter type is unsupported; support for vector types for this target is introduced in iOS 9}}43#endif44}45 46-(float3)retVector { // expected-error {{'float3' (vector of 3 'float' values) return type is unsupported}}47}48 49-(void)takeVector2:(float3)v AVAILABLE_MACOS_10_10 { // expected-error {{'float3' (vector of 3 'float' values) parameter type is unsupported}}50}51 52-(void)takeVector3:(float3)v AVAILABLE_MACOS_10_11 { // expected-error {{'float3' (vector of 3 'float' values) parameter type is unsupported}}53}54 55-(void)takeVector4:(float3)v AVAILABLE_IOS_8 { // expected-error {{'float3' (vector of 3 'float' values) parameter type is unsupported}}56}57 58-(void)takeVector5:(float3)v AVAILABLE_IOS_9 { // expected-error {{'float3' (vector of 3 'float' values) parameter type is unsupported}}59}60 61- (__m128)retM128 { // expected-error {{'__m128' (vector of 4 'float' values) return type is unsupported}}62}63 64- (void)takeM128:(__m128)v { // expected-error {{'__m128' (vector of 4 'float' values) parameter type is unsupported}}65}66 67#else68 69// expected-no-diagnostics70 71-(void)takeVector:(float3)v {72}73 74-(float3)retVector {75  return 0;76}77 78- (__m128)retM128 {79  __m128 value;80  return value;81}82 83- (void)takeM128:(__m128)v {84}85 86-(void)takeVector2:(float3)v AVAILABLE_MACOS_10_10 {87}88 89- (__m128)retM128_2 AVAILABLE_MACOS_10_10 {90  __m128 value;91  return value;92}93 94-(void)takeVector3:(float3)v AVAILABLE_MACOS_10_11 { // no error95}96 97-(void)takeVector4:(float3)v AVAILABLE_IOS_8 {98}99 100-(void)takeVector5:(float3)v AVAILABLE_IOS_9 { // no error101}102 103#ifdef OTHER104// expected-no-diagnostics105#endif106 107#endif108 109-(void)doStuff:(int)m { // no error110}111 112-(struct Aggregate)takesAndRetVectorInAggregate:(struct Aggregate)f { // no error113  struct Aggregate result;114  return result;115}116 117-(struct AggregateFloat)takesAndRetFloatInAggregate:(struct AggregateFloat)f { // no error118  struct AggregateFloat result;119  return result;120}121 122 123@end124