|
2 | 2 | // RUN: %clang_cc1 -triple nvptx64-unknown-unknown -fcuda-is-device -O3 -o - %s -emit-llvm | FileCheck %s
|
3 | 3 | #include "Inputs/cuda.h"
|
4 | 4 |
|
| 5 | +struct char1 { |
| 6 | + char x; |
| 7 | + __host__ __device__ char1(char x = 0) : x(x) {} |
| 8 | +}; |
| 9 | +struct char2 { |
| 10 | + char x, y; |
| 11 | + __host__ __device__ char2(char x = 0, char y = 0) : x(x), y(y) {} |
| 12 | +}; |
| 13 | +struct char4 { |
| 14 | + char x, y, z, w; |
| 15 | + __host__ __device__ char4(char x = 0, char y = 0, char z = 0, char w = 0) : x(x), y(y), z(z), w(w) {} |
| 16 | +}; |
| 17 | + |
| 18 | +struct uchar1 { |
| 19 | + unsigned char x; |
| 20 | + __host__ __device__ uchar1(unsigned char x = 0) : x(x) {} |
| 21 | +}; |
| 22 | +struct uchar2 { |
| 23 | + unsigned char x, y; |
| 24 | + __host__ __device__ uchar2(unsigned char x = 0, unsigned char y = 0) : x(x), y(y) {} |
| 25 | +}; |
| 26 | +struct uchar4 { |
| 27 | + unsigned char x, y, z, w; |
| 28 | + __host__ __device__ uchar4(unsigned char x = 0, unsigned char y = 0, unsigned char z = 0, unsigned char w = 0) : x(x), y(y), z(z), w(w) {} |
| 29 | +}; |
| 30 | + |
| 31 | +struct short1 { |
| 32 | + short x; |
| 33 | + __host__ __device__ short1(short x = 0) : x(x) {} |
| 34 | +}; |
| 35 | +struct short2 { |
| 36 | + short x, y; |
| 37 | + __host__ __device__ short2(short x = 0, short y = 0) : x(x), y(y) {} |
| 38 | +}; |
| 39 | +struct short4 { |
| 40 | + short x, y, z, w; |
| 41 | + __host__ __device__ short4(short x = 0, short y = 0, short z = 0, short w = 0) : x(x), y(y), z(z), w(w) {} |
| 42 | +}; |
| 43 | + |
| 44 | +struct ushort1 { |
| 45 | + unsigned short x; |
| 46 | + __host__ __device__ ushort1(unsigned short x = 0) : x(x) {} |
| 47 | +}; |
| 48 | +struct ushort2 { |
| 49 | + unsigned short x, y; |
| 50 | + __host__ __device__ ushort2(unsigned short x = 0, unsigned short y = 0) : x(x), y(y) {} |
| 51 | +}; |
| 52 | +struct ushort4 { |
| 53 | + unsigned short x, y, z, w; |
| 54 | + __host__ __device__ ushort4(unsigned short x = 0, unsigned short y = 0, unsigned short z = 0, unsigned short w = 0) : x(x), y(y), z(z), w(w) {} |
| 55 | +}; |
| 56 | + |
| 57 | +struct int1 { |
| 58 | + int x; |
| 59 | + __host__ __device__ int1(int x = 0) : x(x) {} |
| 60 | +}; |
| 61 | +struct int2 { |
| 62 | + int x, y; |
| 63 | + __host__ __device__ int2(int x = 0, int y = 0) : x(x), y(y) {} |
| 64 | +}; |
| 65 | +struct int4 { |
| 66 | + int x, y, z, w; |
| 67 | + __host__ __device__ int4(int x = 0, int y = 0, int z = 0, int w = 0) : x(x), y(y), z(z), w(w) {} |
| 68 | +}; |
| 69 | + |
| 70 | +struct uint1 { |
| 71 | + unsigned x; |
| 72 | + __host__ __device__ uint1(unsigned x = 0) : x(x) {} |
| 73 | +}; |
| 74 | +struct uint2 { |
| 75 | + unsigned x, y; |
| 76 | + __host__ __device__ uint2(unsigned x = 0, unsigned y = 0) : x(x), y(y) {} |
| 77 | +}; |
| 78 | +struct uint3 { |
| 79 | + unsigned x, y, z; |
| 80 | + __host__ __device__ uint3(unsigned x = 0, unsigned y = 0, unsigned z = 0) : x(x), y(y), z(z) {} |
| 81 | +}; |
| 82 | +struct uint4 { |
| 83 | + unsigned x, y, z, w; |
| 84 | + __host__ __device__ uint4(unsigned x = 0, unsigned y = 0, unsigned z = 0, unsigned w = 0) : x(x), y(y), z(z), w(w) {} |
| 85 | +}; |
| 86 | + |
| 87 | +struct longlong1 { |
| 88 | + long long x; |
| 89 | + __host__ __device__ longlong1(long long x = 0) : x(x) {} |
| 90 | +}; |
| 91 | +struct longlong2 { |
| 92 | + long long x, y; |
| 93 | + __host__ __device__ longlong2(long long x = 0, long long y = 0) : x(x), y(y) {} |
| 94 | +}; |
| 95 | +struct longlong4 { |
| 96 | + long long x, y, z, w; |
| 97 | + __host__ __device__ longlong4(long long x = 0, long long y = 0, long long z = 0, long long w = 0) : x(x), y(y), z(z), w(w) {} |
| 98 | +}; |
| 99 | + |
| 100 | +struct ulonglong1 { |
| 101 | + unsigned long long x; |
| 102 | + __host__ __device__ ulonglong1(unsigned long long x = 0) : x(x) {} |
| 103 | +}; |
| 104 | +struct ulonglong2 { |
| 105 | + unsigned long long x, y; |
| 106 | + __host__ __device__ ulonglong2(unsigned long long x = 0, unsigned long long y = 0) : x(x), y(y) {} |
| 107 | +}; |
| 108 | +struct ulonglong4 { |
| 109 | + unsigned long long x, y, z, w; |
| 110 | + __host__ __device__ ulonglong4(unsigned long long x = 0, unsigned long long y = 0, unsigned long long z = 0, unsigned long long w = 0) : x(x), y(y), z(z), w(w) {} |
| 111 | +}; |
| 112 | + |
| 113 | +struct float1 { |
| 114 | + float x; |
| 115 | + __host__ __device__ float1(float x = 0) : x(x) {} |
| 116 | +}; |
| 117 | +struct float2 { |
| 118 | + float x, y; |
| 119 | + __host__ __device__ float2(float x = 0, float y = 0) : x(x), y(y) {} |
| 120 | +}; |
| 121 | +struct float4 { |
| 122 | + float x, y, z, w; |
| 123 | + __host__ __device__ float4(float x = 0, float y = 0, float z = 0, float w = 0) : x(x), y(y), z(z), w(w) {} |
| 124 | +}; |
| 125 | + |
| 126 | +struct double1 { |
| 127 | + double x; |
| 128 | + __host__ __device__ double1(double x = 0) : x(x) {} |
| 129 | +}; |
| 130 | +struct double2 { |
| 131 | + double x, y; |
| 132 | + __host__ __device__ double2(double x = 0, double y = 0) : x(x), y(y) {} |
| 133 | +}; |
| 134 | +struct double4 { |
| 135 | + double x, y, z, w; |
| 136 | + __host__ __device__ double4(double x = 0, double y = 0, double z = 0, double w = 0) : x(x), y(y), z(z), w(w) {} |
| 137 | +}; |
| 138 | + |
| 139 | +typedef unsigned long long cudaTextureObject_t; |
| 140 | +typedef unsigned long long cudaSurfaceObject_t; |
| 141 | + |
| 142 | +enum cudaTextureReadMode { |
| 143 | + cudaReadModeNormalizedFloat, |
| 144 | + cudaReadModeElementType |
| 145 | +}; |
| 146 | + |
| 147 | +enum cudaSurfaceBoundaryMode { |
| 148 | + cudaBoundaryModeZero, |
| 149 | + cudaBoundaryModeClamp, |
| 150 | + cudaBoundaryModeTrap |
| 151 | +}; |
| 152 | + |
| 153 | +enum { |
| 154 | + cudaTextureType1D, |
| 155 | + cudaTextureType2D, |
| 156 | + cudaTextureType3D, |
| 157 | + cudaTextureTypeCubemap, |
| 158 | + cudaTextureType1DLayered, |
| 159 | + cudaTextureType2DLayered, |
| 160 | + cudaTextureTypeCubemapLayered |
| 161 | +}; |
| 162 | + |
| 163 | +struct textureReference {}; |
| 164 | +template <class T, int texType = cudaTextureType1D, |
| 165 | + enum cudaTextureReadMode mode = cudaReadModeElementType> |
| 166 | +struct __attribute__((device_builtin_texture_type)) texture |
| 167 | + : public textureReference {}; |
| 168 | + |
5 | 169 | #include "__clang_cuda_texture_intrinsics.h"
|
6 | 170 |
|
7 | 171 | __device__ void surfchar(cudaSurfaceObject_t surf, int x, int y, int z, int layer, int face, int layerface) {
|
|
0 commit comments