1 // RUN: %clang_cc1 -fsyntax-only -verify %s -DHOST -triple x86_64-unknown-linux-gnu -Wuninitialized
2 // RUN: %clang_cc1 -fsyntax-only -verify %s -DHOST -DHOST_USED -triple x86_64-unknown-linux-gnu -Wuninitialized
3 // RUN: %clang_cc1 -fsyntax-only -fcuda-is-device -verify %s -DDEVICE_NOT_USED -triple nvptx-unknown-cuda -Wuninitialized
4 // RUN: %clang_cc1 -fsyntax-only -fcuda-is-device -verify %s -DDEVICE -triple nvptx-unknown-cuda -Wuninitialized
5 // RUN: %clang_cc1 -fsyntax-only -fcuda-is-device -verify %s -DDEVICE -DDEVICE_USED -triple nvptx-unknown-cuda -Wuninitialized
7 // REQUIRES: x86-registered-target
8 // REQUIRES: nvptx-registered-target
10 #if (defined(HOST) && !defined(HOST_USED)) || defined(DEVICE_NOT_USED)
11 // expected-no-diagnostics
14 #include "Inputs/cuda.h"
16 static __device__ __host__ void t1(int r) {
17 __asm__("PR3908 %[lf] %[xx] %[li] %[r]"
19 : [ lf ] "mx"(0), [ li ] "mr"(0), [ xx ] "x"((double)(0)));
22 static __device__ __host__ unsigned t2(signed char input) {
30 static __device__ __host__ double t3(double x) {
32 __asm __volatile("frndint"
38 static __device__ __host__ unsigned char t4(unsigned char a, unsigned char b) {
44 : [ bigres ] "=la"(bigres)
45 : [ la ] "0"(la), [ lb ] "c"(lb)
51 static __device__ __host__ void t5(void) {
56 : "st", "st(1)", "st(2)", "st(3)",
57 "st(4)", "st(5)", "st(6)", "st(7)",
61 typedef long long __m256i __attribute__((__vector_size__(32)));
62 static __device__ __host__ void t6(__m256i *p) {
63 __asm__ volatile("vmovaps %0, %%ymm0" ::"m"(*(__m256i *)p)
67 static __device__ __host__ void t7(__m256i *p) {
68 __asm__ volatile("vmovaps %0, %%ymm0" ::"m"(*(__m256i *)p)
102 #if defined(HOST_USED)
103 // expected-error@69 {{unknown register name 'r0' in asm}}
104 // expected-note@96 {{called by 'main'}}
105 #elif defined(DEVICE)
106 // expected-error@19 {{invalid input constraint 'mx' in asm}}
107 // expected-error@25 {{invalid output constraint '=a' in asm}}
108 // expected-error@33 {{invalid output constraint '=t' in asm}}
109 // expected-error@44 {{invalid output constraint '=la' in asm}}
110 // expected-error@56 {{unknown register name 'st' in asm}}
111 // expected-error@64 {{unknown register name 'ymm0' in asm}}
112 // expected-note@74 {{called by 'm'}}
113 // expected-note@75 {{called by 'm'}}
114 // expected-note@76 {{called by 'm'}}
115 // expected-note@77 {{called by 'm'}}
116 // expected-note@78 {{called by 'm'}}
117 // expected-note@79 {{called by 'm'}}