| 1 |
// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.2-library %s -fnative-half-type -fnative-int16-type -emit-llvm -O1 -o - | FileCheck %s |
| 2 |
|
| 3 |
//CHECK-LABEL: define {{.*}}test_ints |
| 4 |
//CHECK-SAME: {{.*}}(i16 {{.*}} [[VAL:%.*]]){{.*}} |
| 5 |
//CHECK-NOT: bitcast |
| 6 |
//CHECK: entry: |
| 7 |
//CHECK-NEXT: ret i16 [[VAL]] |
| 8 |
int16_t test_int(int16_t p0) |
| 9 |
{ |
| 10 |
return asint16(p0); |
| 11 |
} |
| 12 |
|
| 13 |
//CHECK-LABEL: define {{.*}}test_uint |
| 14 |
//CHECK-SAME: {{.*}}(i16 {{.*}} [[VAL:%.*]]){{.*}} |
| 15 |
//CHECK-NOT:bitcast |
| 16 |
//CHECK: entry: |
| 17 |
//CHECK-NEXT: ret i16 [[VAL]] |
| 18 |
int16_t test_uint(uint16_t p0) |
| 19 |
{ |
| 20 |
return asint16(p0); |
| 21 |
} |
| 22 |
|
| 23 |
//CHECK-LABEL: define {{.*}}test_half |
| 24 |
//CHECK-SAME: {{.*}}(half {{.*}} [[VAL:%.*]]){{.*}} |
| 25 |
//CHECK: [[RES:%.*]] = bitcast half [[VAL]] to i16 |
| 26 |
//CHECK-NEXT : ret i16 [[RES]] |
| 27 |
int16_t test_half(half p0) |
| 28 |
{ |
| 29 |
return asint16(p0); |
| 30 |
} |
| 31 |
|
| 32 |
//CHECK-LABEL: define {{.*}}test_vector_int |
| 33 |
//CHECK-SAME: {{.*}}(<4 x i16> {{.*}} [[VAL:%.*]]){{.*}} |
| 34 |
//CHECK-NOT: bitcast |
| 35 |
//CHECK: entry: |
| 36 |
//CHECK-NEXT: ret <4 x i16> [[VAL]] |
| 37 |
int16_t4 test_vector_int(int16_t4 p0) |
| 38 |
{ |
| 39 |
return asint16(p0); |
| 40 |
} |
| 41 |
|
| 42 |
//CHECK-LABEL: define {{.*}}test_vector_uint |
| 43 |
//CHECK-SAME: {{.*}}(<4 x i16> {{.*}} [[VAL:%.*]]){{.*}} |
| 44 |
//CHECK-NOT: bitcast |
| 45 |
//CHECK-NEXT: entry: |
| 46 |
//CHECK-NEXT: ret <4 x i16> [[VAL]] |
| 47 |
int16_t4 test_vector_uint(uint16_t4 p0) |
| 48 |
{ |
| 49 |
return asint16(p0); |
| 50 |
} |
| 51 |
|
| 52 |
//CHECK-LABEL: define {{.*}}fn |
| 53 |
//CHECK-SAME: {{.*}}(<4 x half> {{.*}} [[VAL:%.*]]){{.*}} |
| 54 |
//CHECK: [[RES:%.*]] = bitcast <4 x half> [[VAL]] to <4 x i16> |
| 55 |
//CHECK-NEXT: ret <4 x i16> [[RES]] |
| 56 |
int16_t4 fn(half4 p1) |
| 57 |
{ |
| 58 |
return asint16(p1); |
| 59 |
} |
| 60 |
|