brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.7 KiB · a460679 Raw
88 lines · cpp
1// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -S -verify -o - -DTEST12// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -S -verify -o - -DTEST23// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -S -verify -o - -DTEST34// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -S -verify -o - -DTEST45 6struct S {7  __attribute__((always_inline, target("avx512f")))8  void foo(){}9  __attribute__((always_inline, target("avx512f")))10  operator int(){ return 0; }11  __attribute__((always_inline, target("avx512f")))12  void operator()(){ }13 14};15__attribute__((always_inline, target("avx512f")))16void free_func(){}17 18 19#ifdef TEST120void usage(S & s) {21  s.foo(); // expected-error {{'foo' requires target feature 'avx512f'}}22  (void)(int)s; // expected-error {{'operator int' requires target feature 'avx512f'}}23  s(); // expected-error {{'operator()' requires target feature 'avx512f'}}24  free_func(); // expected-error{{'free_func' requires target feature 'avx512f'}}25 26}27#endif28 29#ifdef TEST230__attribute__((target("avx512f")))31void usage(S & s) {32  s.foo();33  (void)(int)s;34  s();35 36  [&s] {37    s.foo();       // expected-error {{'foo' requires target feature 'avx512f'}}38    (void)(int) s; // expected-error {{'operator int' requires target feature 'avx512f'}}39    s();           // expected-error {{'operator()' requires target feature 'avx512f'}}40    free_func();   // expected-error{{'free_func' requires target feature 'avx512f'}}41  }();42}43#endif44 45#ifdef TEST346void usage(S & s) {47 48  [&s] () __attribute__((target("avx512f"))) {49    s.foo();50    (void)(int) s;51    s();52    free_func();53  }();54 55  [&s] {56    s.foo();       // expected-error {{'foo' requires target feature 'avx512f'}}57    (void)(int) s; // expected-error {{'operator int' requires target feature 'avx512f'}}58    s();           // expected-error {{'operator()' requires target feature 'avx512f'}}59    free_func();   // expected-error{{'free_func' requires target feature 'avx512f'}}60  }();61}62#endif63 64#ifdef TEST465namespace PR45468 {66  struct CtorAndDTor {67    __attribute__((always_inline, target("avx512f"))) CtorAndDTor();68    __attribute__((always_inline, target("avx512f"))) ~CtorAndDTor();69  };70 71  void usage() {72    //expected-error@+1{{'CtorAndDTor' requires target feature 'avx512f'}}73    CtorAndDTor c;74    {75      //expected-error@+1{{'CtorAndDTor' requires target feature 'avx512f'}}76      CtorAndDTor c2;77      //expected-error@+1{{'~CtorAndDTor' requires target feature 'avx512f'}}78      c2.~CtorAndDTor();79    }80    // FIXME: These need to be given a line number, however there's no good way81    // to get to the SourceLocation of anything by the time we're doing CodeGen82    // cleanups.83    //expected-error@*{{'~CtorAndDTor' requires target feature 'avx512f'}}84    //expected-error@*{{'~CtorAndDTor' requires target feature 'avx512f'}}85  }86}87#endif88