| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,56 +1,56 @@ | ||
| // RUN: %clang_cc1 -ast-dump %s 2>&1 | FileCheck %s | ||
|
|
||
| // CHECK-LABEL: example0 | ||
| void example0() { | ||
| double d = 2.0; | ||
| // CHECK: VarDecl{{.*}}rd 'double &' | ||
| // CHECK-NEXT: DeclRefExpr | ||
| double &rd = d; | ||
| // CHECK: VarDecl{{.*}}rcd 'const double &' | ||
| // CHECK-NEXT: ImplicitCastExpr{{.*}}'const double' lvalue <NoOp> | ||
| const double &rcd = d; | ||
| } | ||
|
|
||
| struct A { }; | ||
| struct B : A { } b; | ||
|
|
||
| // CHECK-LABEL: example1 | ||
| void example1() { | ||
| // CHECK: VarDecl{{.*}}ra 'A &' | ||
| // CHECK: ImplicitCastExpr{{.*}}'A' lvalue <DerivedToBase (A)> | ||
| A &ra = b; | ||
| // CHECK: VarDecl{{.*}}rca 'const A &' | ||
| // CHECK: ImplicitCastExpr{{.*}}'const A' lvalue <DerivedToBase (A)> | ||
| // CHECK-NOT: MaterializeTemporaryExpr | ||
| // CHECK: ImplicitCastExpr{{.*}}'const B' lvalue <NoOp> | ||
| const A& rca = b; | ||
| } | ||
|
|
||
| extern B f(); | ||
|
|
||
| struct X { | ||
| operator B(); | ||
| } x; | ||
|
|
||
| // CHECK-LABEL: example2 | ||
| void example2() { | ||
| // CHECK: VarDecl{{.*}}rca 'const A &' | ||
| // CHECK: ImplicitCastExpr{{.*}}'const A' lvalue <DerivedToBase (A)> | ||
| // CHECK: MaterializeTemporaryExpr{{.*}}'const B' | ||
| // CHECK: ImplicitCastExpr{{.*}}'const B' <NoOp> | ||
| // CHECK: CallExpr{{.*}}B | ||
| const A &rca = f(); | ||
| // CHECK: VarDecl{{.*}}r 'const A &' | ||
| // CHECK: ImplicitCastExpr{{.*}}'const A' lvalue <DerivedToBase (A)> | ||
| // CHECK: MaterializeTemporaryExpr{{.*}}'const B' | ||
| // CHECK: ImplicitCastExpr{{.*}}'const B' <NoOp> | ||
| // CHECK: CXXMemberCallExpr{{.*}}'B' | ||
| const A& r = x; | ||
| } | ||
|
|
||
| // CHECK-LABEL: example3 | ||
| void example3() { | ||
| // CHECK: VarDecl{{.*}}rcd2 'const double &' | ||
| // CHECK: ImplicitCastExpr{{.*}} <IntegralToFloating> | ||
| const double& rcd2 = 2; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,22 @@ | ||
| // RUN: %clang_cc1 -fsyntax-only -std=c++1z %s -verify | ||
|
|
||
| class NonCopyable { | ||
| NonCopyable(const NonCopyable&) = delete; //expected-note3{{explicitly marked deleted here}} | ||
| int x = 10; | ||
| void foo() { | ||
| auto L = [this] { return x; }; | ||
| const auto &M = [*this] { return x; };//expected-error{{call to deleted}} | ||
| const auto &M2 = [this] () -> auto&& { | ||
| ++x; | ||
| return [*this] { //expected-error{{call to deleted}} expected-warning{{reference to local}} | ||
| return ++x; //expected-error{{read-only}} | ||
| }; | ||
| }; | ||
| const auto &M3 = [*this] () mutable -> auto&& { //expected-error{{call to deleted}} | ||
| ++x; | ||
| return [this] { // expected-warning{{reference to local}} | ||
| return x; | ||
| }; | ||
| }; | ||
| } | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,17 @@ | ||
| // RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s | ||
| // expected-no-diagnostics | ||
|
|
||
| // NOTE: This file intentionally uses DOS-style line endings to test | ||
| // that we don't propagate them into string literals as per [lex.string]p4. | ||
|
|
||
| constexpr const char* p = R"(a\ | ||
| b | ||
| c)"; | ||
|
|
||
| static_assert(p[0] == 'a', ""); | ||
| static_assert(p[1] == '\\', ""); | ||
| static_assert(p[2] == '\n', ""); | ||
| static_assert(p[3] == 'b', ""); | ||
| static_assert(p[4] == '\n', ""); | ||
| static_assert(p[5] == 'c', ""); | ||
| static_assert(p[6] == '\0', ""); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,25 @@ | ||
| // RUN: %clang_cc1 -frounding-math -ffp-exception-behavior=strict -fexperimental-strict-floating-point -emit-llvm -o - %s | FileCheck %s -check-prefix=FPMODELSTRICT | ||
| // RUN: %clang_cc1 -ffp-contract=fast -emit-llvm -o - %s | FileCheck %s -check-prefix=PRECISE | ||
| // RUN: %clang_cc1 -ffast-math -ffp-contract=fast -emit-llvm -o - %s | FileCheck %s -check-prefix=FAST | ||
| // RUN: %clang_cc1 -ffast-math -emit-llvm -o - %s | FileCheck %s -check-prefix=FASTNOCONTRACT | ||
| // RUN: %clang_cc1 -ffast-math -ffp-contract=fast -ffp-exception-behavior=ignore -emit-llvm -o - %s | FileCheck %s -check-prefix=FAST | ||
| // RUN: %clang_cc1 -ffast-math -ffp-contract=fast -ffp-exception-behavior=strict -fexperimental-strict-floating-point -emit-llvm -o - %s | FileCheck %s -check-prefix=EXCEPT | ||
| // RUN: %clang_cc1 -ffast-math -ffp-contract=fast -ffp-exception-behavior=maytrap -fexperimental-strict-floating-point -emit-llvm -o - %s | FileCheck %s -check-prefix=MAYTRAP | ||
|
|
||
| float f0, f1, f2; | ||
|
|
||
| void foo(void) { | ||
| // CHECK-LABEL: define {{.*}}void @foo() | ||
|
|
||
| // MAYTRAP: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.maytrap") | ||
| // EXCEPT: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict") | ||
| // FPMODELSTRICT: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict") | ||
| // STRICTEXCEPT: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict") | ||
| // STRICTNOEXCEPT: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.dynamic", metadata !"fpexcept.ignore") | ||
| // PRECISE: fadd contract float %{{.*}}, %{{.*}} | ||
| // FAST: fadd fast | ||
| // FASTNOCONTRACT: fadd reassoc nnan ninf nsz arcp afn float | ||
| f0 = f1 + f2; | ||
|
|
||
| // CHECK: ret | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,49 +1,49 @@ | ||
| // RUN: %clang_cc1 -x c++ -fexceptions -fcxx-exceptions -frounding-math -ffp-exception-behavior=strict -fexperimental-strict-floating-point -emit-llvm -o - %s | FileCheck %s -check-prefix=FPMODELSTRICT | ||
| // RUN: %clang_cc1 -x c++ -ffp-contract=fast -fexceptions -fcxx-exceptions -emit-llvm -o - %s | FileCheck %s -check-prefix=PRECISE | ||
| // RUN: %clang_cc1 -x c++ -ffast-math -fexceptions -fcxx-exceptions -ffp-contract=fast -emit-llvm -o - %s | FileCheck %s -check-prefix=FAST | ||
| // RUN: %clang_cc1 -x c++ -ffast-math -fexceptions -fcxx-exceptions -emit-llvm -o - %s | FileCheck %s -check-prefix=FASTNOCONTRACT | ||
| // RUN: %clang_cc1 -x c++ -ffast-math -fexceptions -fcxx-exceptions -ffp-contract=fast -ffp-exception-behavior=ignore -emit-llvm -o - %s | FileCheck %s -check-prefix=FAST | ||
| // RUN: %clang_cc1 -x c++ -ffast-math -fexceptions -fcxx-exceptions -ffp-contract=fast -ffp-exception-behavior=strict -fexperimental-strict-floating-point -emit-llvm -o - %s | FileCheck %s -check-prefix=EXCEPT | ||
| // RUN: %clang_cc1 -x c++ -ffast-math -fexceptions -fcxx-exceptions -ffp-contract=fast -ffp-exception-behavior=maytrap -fexperimental-strict-floating-point -emit-llvm -o - %s | FileCheck %s -check-prefix=MAYTRAP | ||
|
|
||
| float f0, f1, f2; | ||
|
|
||
| template <class> | ||
| class aaaa { | ||
| public: | ||
| ~aaaa(); | ||
| void b(); | ||
| }; | ||
|
|
||
| template <class c> | ||
| aaaa<c>::~aaaa() { try { | ||
| b(); | ||
| // CHECK-LABEL: define {{.*}}void @_ZN4aaaaIiED2Ev{{.*}} | ||
|
|
||
| } catch (...) { | ||
| // MAYTRAP: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.maytrap") | ||
| // EXCEPT: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict") | ||
| // FPMODELSTRICT: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict") | ||
| // STRICTEXCEPT: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict") | ||
| // STRICTNOEXCEPT: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.dynamic", metadata !"fpexcept.ignore") | ||
| // PRECISE: fadd contract float %{{.*}}, %{{.*}} | ||
| // FAST: fadd fast | ||
| // FASTNOCONTRACT: fadd reassoc nnan ninf nsz arcp afn float | ||
| f0 = f1 + f2; | ||
|
|
||
| // CHECK: ret void | ||
| } | ||
| } | ||
|
|
||
| class d { | ||
| public: | ||
| d(const char *, int); | ||
| aaaa<int> e; | ||
| }; | ||
|
|
||
| float foo() { | ||
| d x("", 1); | ||
| aaaa<int> a; | ||
| return f0; | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,31 +1,31 @@ | ||
| // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu %s -emit-llvm -o - | FileCheck %s | ||
| // RUN: %clang_cc1 -triple x86_64-pc-win32 %s -emit-llvm -o - | FileCheck %s | ||
|
|
||
| // CHECK: foo{{[^#]*}}#[[ATTRS:[0-9]+]] | ||
| __attribute__((no_caller_saved_registers)) void foo() {} | ||
| namespace S { | ||
| // CHECK: bar{{[^#]*}}#[[ATTRS]] | ||
| __attribute__((no_caller_saved_registers)) void bar(int *a) { foo(); } | ||
| } | ||
|
|
||
| struct St { | ||
| static void baz(int *a) __attribute__((no_caller_saved_registers)) { S::bar(a); } | ||
| }; | ||
|
|
||
| __attribute((no_caller_saved_registers)) void (*foobar)(void); | ||
|
|
||
| // CHECK-LABEL: @main | ||
| int main(int argc, char **argv) { | ||
| St::baz(&argc); | ||
| // CHECK: [[FOOBAR:%.+]] = load ptr, ptr @{{.*}}foobar{{.*}}, | ||
| // CHECK-NEXT: call void [[FOOBAR]]() #[[ATTRS1:.+]] | ||
| foobar(); | ||
| return 0; | ||
| } | ||
|
|
||
| // CHECK: baz{{[^#]*}}#[[ATTRS]] | ||
|
|
||
| // CHECK: attributes #[[ATTRS]] = { | ||
| // CHECK-SAME: "no_caller_saved_registers" | ||
| // CHECK-SAME: } | ||
| // CHECK: attributes #[[ATTRS1]] = { "no_caller_saved_registers" } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,22 @@ | ||
| // RUN: %clang_cc1 -emit-llvm %s -triple x86_64-windows-msvc -gcodeview -debug-info-kind=limited -o - | FileCheck %s | ||
|
|
||
| struct a { | ||
| ~a(); | ||
| }; | ||
| template <typename b> struct c : a { | ||
| c(void (b::*)()); | ||
| }; | ||
| struct B { | ||
| virtual void e(); | ||
| }; | ||
| c<B> *d() { | ||
| static c<B> f(&B::e); | ||
| return &f; | ||
| } | ||
|
|
||
| // CHECK: define internal void @"??__Ff@?1??d@@YAPEAU?$c@UB@@@@XZ@YAXXZ"() | ||
| // CHECK-SAME: !dbg ![[SUBPROGRAM:[0-9]+]] { | ||
| // CHECK: call void @"??1?$c@UB@@@@QEAA@XZ"(ptr @"?f@?1??d@@YAPEAU?$c@UB@@@@XZ@4U2@A"), !dbg ![[LOCATION:[0-9]+]] | ||
| // CHECK: ![[SUBPROGRAM]] = distinct !DISubprogram(name: "`dynamic atexit destructor for 'f'" | ||
| // CHECK-SAME: flags: DIFlagArtificial | ||
| // CHECK: ![[LOCATION]] = !DILocation(line: 0, scope: ![[SUBPROGRAM]]) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,134 +1,134 @@ | ||
| // RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \ | ||
| // RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ | ||
| // RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ | ||
| // RUN: --check-prefixes=CHECK,NATIVE_HALF | ||
| // RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \ | ||
| // RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \ | ||
| // RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF | ||
|
|
||
| #ifdef __HLSL_ENABLE_16_BIT | ||
| // NATIVE_HALF: define noundef i16 @ | ||
| // NATIVE_HALF: call i16 @llvm.dx.clamp.i16( | ||
| int16_t test_clamp_short(int16_t p0, int16_t p1) { return clamp(p0, p1,p1); } | ||
| // NATIVE_HALF: define noundef <2 x i16> @ | ||
| // NATIVE_HALF: call <2 x i16> @llvm.dx.clamp.v2i16( | ||
| int16_t2 test_clamp_short2(int16_t2 p0, int16_t2 p1) { return clamp(p0, p1,p1); } | ||
| // NATIVE_HALF: define noundef <3 x i16> @ | ||
| // NATIVE_HALF: call <3 x i16> @llvm.dx.clamp.v3i16 | ||
| int16_t3 test_clamp_short3(int16_t3 p0, int16_t3 p1) { return clamp(p0, p1,p1); } | ||
| // NATIVE_HALF: define noundef <4 x i16> @ | ||
| // NATIVE_HALF: call <4 x i16> @llvm.dx.clamp.v4i16 | ||
| int16_t4 test_clamp_short4(int16_t4 p0, int16_t4 p1) { return clamp(p0, p1,p1); } | ||
|
|
||
| // NATIVE_HALF: define noundef i16 @ | ||
| // NATIVE_HALF: call i16 @llvm.dx.uclamp.i16( | ||
| uint16_t test_clamp_ushort(uint16_t p0, uint16_t p1) { return clamp(p0, p1,p1); } | ||
| // NATIVE_HALF: define noundef <2 x i16> @ | ||
| // NATIVE_HALF: call <2 x i16> @llvm.dx.uclamp.v2i16 | ||
| uint16_t2 test_clamp_ushort2(uint16_t2 p0, uint16_t2 p1) { return clamp(p0, p1,p1); } | ||
| // NATIVE_HALF: define noundef <3 x i16> @ | ||
| // NATIVE_HALF: call <3 x i16> @llvm.dx.uclamp.v3i16 | ||
| uint16_t3 test_clamp_ushort3(uint16_t3 p0, uint16_t3 p1) { return clamp(p0, p1,p1); } | ||
| // NATIVE_HALF: define noundef <4 x i16> @ | ||
| // NATIVE_HALF: call <4 x i16> @llvm.dx.uclamp.v4i16 | ||
| uint16_t4 test_clamp_ushort4(uint16_t4 p0, uint16_t4 p1) { return clamp(p0, p1,p1); } | ||
| #endif | ||
|
|
||
| // CHECK: define noundef i32 @ | ||
| // CHECK: call i32 @llvm.dx.clamp.i32( | ||
| int test_clamp_int(int p0, int p1) { return clamp(p0, p1,p1); } | ||
| // CHECK: define noundef <2 x i32> @ | ||
| // CHECK: call <2 x i32> @llvm.dx.clamp.v2i32 | ||
| int2 test_clamp_int2(int2 p0, int2 p1) { return clamp(p0, p1,p1); } | ||
| // CHECK: define noundef <3 x i32> @ | ||
| // CHECK: call <3 x i32> @llvm.dx.clamp.v3i32 | ||
| int3 test_clamp_int3(int3 p0, int3 p1) { return clamp(p0, p1,p1); } | ||
| // CHECK: define noundef <4 x i32> @ | ||
| // CHECK: call <4 x i32> @llvm.dx.clamp.v4i32 | ||
| int4 test_clamp_int4(int4 p0, int4 p1) { return clamp(p0, p1,p1); } | ||
|
|
||
| // CHECK: define noundef i32 @ | ||
| // CHECK: call i32 @llvm.dx.uclamp.i32( | ||
| int test_clamp_uint(uint p0, uint p1) { return clamp(p0, p1,p1); } | ||
| // CHECK: define noundef <2 x i32> @ | ||
| // CHECK: call <2 x i32> @llvm.dx.uclamp.v2i32 | ||
| uint2 test_clamp_uint2(uint2 p0, uint2 p1) { return clamp(p0, p1,p1); } | ||
| // CHECK: define noundef <3 x i32> @ | ||
| // CHECK: call <3 x i32> @llvm.dx.uclamp.v3i32 | ||
| uint3 test_clamp_uint3(uint3 p0, uint3 p1) { return clamp(p0, p1,p1); } | ||
| // CHECK: define noundef <4 x i32> @ | ||
| // CHECK: call <4 x i32> @llvm.dx.uclamp.v4i32 | ||
| uint4 test_clamp_uint4(uint4 p0, uint4 p1) { return clamp(p0, p1,p1); } | ||
|
|
||
| // CHECK: define noundef i64 @ | ||
| // CHECK: call i64 @llvm.dx.clamp.i64( | ||
| int64_t test_clamp_long(int64_t p0, int64_t p1) { return clamp(p0, p1,p1); } | ||
| // CHECK: define noundef <2 x i64> @ | ||
| // CHECK: call <2 x i64> @llvm.dx.clamp.v2i64 | ||
| int64_t2 test_clamp_long2(int64_t2 p0, int64_t2 p1) { return clamp(p0, p1,p1); } | ||
| // CHECK: define noundef <3 x i64> @ | ||
| // CHECK: call <3 x i64> @llvm.dx.clamp.v3i64 | ||
| int64_t3 test_clamp_long3(int64_t3 p0, int64_t3 p1) { return clamp(p0, p1,p1); } | ||
| // CHECK: define noundef <4 x i64> @ | ||
| // CHECK: call <4 x i64> @llvm.dx.clamp.v4i64 | ||
| int64_t4 test_clamp_long4(int64_t4 p0, int64_t4 p1) { return clamp(p0, p1,p1); } | ||
|
|
||
| // CHECK: define noundef i64 @ | ||
| // CHECK: call i64 @llvm.dx.uclamp.i64( | ||
| uint64_t test_clamp_long(uint64_t p0, uint64_t p1) { return clamp(p0, p1,p1); } | ||
| // CHECK: define noundef <2 x i64> @ | ||
| // CHECK: call <2 x i64> @llvm.dx.uclamp.v2i64 | ||
| uint64_t2 test_clamp_long2(uint64_t2 p0, uint64_t2 p1) { return clamp(p0, p1,p1); } | ||
| // CHECK: define noundef <3 x i64> @ | ||
| // CHECK: call <3 x i64> @llvm.dx.uclamp.v3i64 | ||
| uint64_t3 test_clamp_long3(uint64_t3 p0, uint64_t3 p1) { return clamp(p0, p1,p1); } | ||
| // CHECK: define noundef <4 x i64> @ | ||
| // CHECK: call <4 x i64> @llvm.dx.uclamp.v4i64 | ||
| uint64_t4 test_clamp_long4(uint64_t4 p0, uint64_t4 p1) { return clamp(p0, p1,p1); } | ||
|
|
||
| // NATIVE_HALF: define noundef half @ | ||
| // NATIVE_HALF: call half @llvm.dx.clamp.f16( | ||
| // NO_HALF: define noundef float @"?test_clamp_half | ||
| // NO_HALF: call float @llvm.dx.clamp.f32( | ||
| half test_clamp_half(half p0, half p1) { return clamp(p0, p1,p1); } | ||
| // NATIVE_HALF: define noundef <2 x half> @ | ||
| // NATIVE_HALF: call <2 x half> @llvm.dx.clamp.v2f16 | ||
| // NO_HALF: define noundef <2 x float> @"?test_clamp_half2 | ||
| // NO_HALF: call <2 x float> @llvm.dx.clamp.v2f32( | ||
| half2 test_clamp_half2(half2 p0, half2 p1) { return clamp(p0, p1,p1); } | ||
| // NATIVE_HALF: define noundef <3 x half> @ | ||
| // NATIVE_HALF: call <3 x half> @llvm.dx.clamp.v3f16 | ||
| // NO_HALF: define noundef <3 x float> @"?test_clamp_half3 | ||
| // NO_HALF: call <3 x float> @llvm.dx.clamp.v3f32( | ||
| half3 test_clamp_half3(half3 p0, half3 p1) { return clamp(p0, p1,p1); } | ||
| // NATIVE_HALF: define noundef <4 x half> @ | ||
| // NATIVE_HALF: call <4 x half> @llvm.dx.clamp.v4f16 | ||
| // NO_HALF: define noundef <4 x float> @"?test_clamp_half4 | ||
| // NO_HALF: call <4 x float> @llvm.dx.clamp.v4f32( | ||
| half4 test_clamp_half4(half4 p0, half4 p1) { return clamp(p0, p1,p1); } | ||
|
|
||
| // CHECK: define noundef float @"?test_clamp_float | ||
| // CHECK: call float @llvm.dx.clamp.f32( | ||
| float test_clamp_float(float p0, float p1) { return clamp(p0, p1,p1); } | ||
| // CHECK: define noundef <2 x float> @"?test_clamp_float2 | ||
| // CHECK: call <2 x float> @llvm.dx.clamp.v2f32 | ||
| float2 test_clamp_float2(float2 p0, float2 p1) { return clamp(p0, p1,p1); } | ||
| // CHECK: define noundef <3 x float> @"?test_clamp_float3 | ||
| // CHECK: call <3 x float> @llvm.dx.clamp.v3f32 | ||
| float3 test_clamp_float3(float3 p0, float3 p1) { return clamp(p0, p1,p1); } | ||
| // CHECK: define noundef <4 x float> @"?test_clamp_float4 | ||
| // CHECK: call <4 x float> @llvm.dx.clamp.v4f32 | ||
| float4 test_clamp_float4(float4 p0, float4 p1) { return clamp(p0, p1,p1); } | ||
|
|
||
| // CHECK: define noundef double @ | ||
| // CHECK: call double @llvm.dx.clamp.f64( | ||
| double test_clamp_double(double p0, double p1) { return clamp(p0, p1,p1); } | ||
| // CHECK: define noundef <2 x double> @ | ||
| // CHECK: call <2 x double> @llvm.dx.clamp.v2f64 | ||
| double2 test_clamp_double2(double2 p0, double2 p1) { return clamp(p0, p1,p1); } | ||
| // CHECK: define noundef <3 x double> @ | ||
| // CHECK: call <3 x double> @llvm.dx.clamp.v3f64 | ||
| double3 test_clamp_double3(double3 p0, double3 p1) { return clamp(p0, p1,p1); } | ||
| // CHECK: define noundef <4 x double> @ | ||
| // CHECK: call <4 x double> @llvm.dx.clamp.v4f64 | ||
| double4 test_clamp_double4(double4 p0, double4 p1) { return clamp(p0, p1,p1); } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,41 +1,41 @@ | ||
| // RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \ | ||
| // RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ | ||
| // RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ | ||
| // RUN: --check-prefixes=CHECK,NATIVE_HALF | ||
| // RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \ | ||
| // RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \ | ||
| // RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF | ||
|
|
||
| // NATIVE_HALF: define noundef half @ | ||
| // NATIVE_HALF: call half @llvm.cos.f16( | ||
| // NO_HALF: define noundef float @"?test_cos_half | ||
| // NO_HALF: call float @llvm.cos.f32( | ||
| half test_cos_half(half p0) { return cos(p0); } | ||
| // NATIVE_HALF: define noundef <2 x half> @ | ||
| // NATIVE_HALF: call <2 x half> @llvm.cos.v2f16 | ||
| // NO_HALF: define noundef <2 x float> @"?test_cos_half2 | ||
| // NO_HALF: call <2 x float> @llvm.cos.v2f32( | ||
| half2 test_cos_half2(half2 p0) { return cos(p0); } | ||
| // NATIVE_HALF: define noundef <3 x half> @ | ||
| // NATIVE_HALF: call <3 x half> @llvm.cos.v3f16 | ||
| // NO_HALF: define noundef <3 x float> @"?test_cos_half3 | ||
| // NO_HALF: call <3 x float> @llvm.cos.v3f32( | ||
| half3 test_cos_half3(half3 p0) { return cos(p0); } | ||
| // NATIVE_HALF: define noundef <4 x half> @ | ||
| // NATIVE_HALF: call <4 x half> @llvm.cos.v4f16 | ||
| // NO_HALF: define noundef <4 x float> @"?test_cos_half4 | ||
| // NO_HALF: call <4 x float> @llvm.cos.v4f32( | ||
| half4 test_cos_half4(half4 p0) { return cos(p0); } | ||
|
|
||
| // CHECK: define noundef float @"?test_cos_float | ||
| // CHECK: call float @llvm.cos.f32( | ||
| float test_cos_float(float p0) { return cos(p0); } | ||
| // CHECK: define noundef <2 x float> @"?test_cos_float2 | ||
| // CHECK: call <2 x float> @llvm.cos.v2f32 | ||
| float2 test_cos_float2(float2 p0) { return cos(p0); } | ||
| // CHECK: define noundef <3 x float> @"?test_cos_float3 | ||
| // CHECK: call <3 x float> @llvm.cos.v3f32 | ||
| float3 test_cos_float3(float3 p0) { return cos(p0); } | ||
| // CHECK: define noundef <4 x float> @"?test_cos_float4 | ||
| // CHECK: call <4 x float> @llvm.cos.v4f32 | ||
| float4 test_cos_float4(float4 p0) { return cos(p0); } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,43 +1,43 @@ | ||
| // RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \ | ||
| // RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ | ||
| // RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ | ||
| // RUN: --check-prefixes=CHECK,NATIVE_HALF | ||
| // RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \ | ||
| // RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \ | ||
| // RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF | ||
|
|
||
| using hlsl::floor; | ||
|
|
||
| // NATIVE_HALF: define noundef half @ | ||
| // NATIVE_HALF: call half @llvm.floor.f16( | ||
| // NO_HALF: define noundef float @"?test_floor_half@@YA$halff@$halff@@Z"( | ||
| // NO_HALF: call float @llvm.floor.f32(float %0) | ||
| half test_floor_half(half p0) { return floor(p0); } | ||
| // NATIVE_HALF: define noundef <2 x half> @ | ||
| // NATIVE_HALF: call <2 x half> @llvm.floor.v2f16( | ||
| // NO_HALF: define noundef <2 x float> @"?test_floor_half2@@YAT?$__vector@$halff@$01@__clang@@T12@@Z"( | ||
| // NO_HALF: call <2 x float> @llvm.floor.v2f32( | ||
| half2 test_floor_half2(half2 p0) { return floor(p0); } | ||
| // NATIVE_HALF: define noundef <3 x half> @ | ||
| // NATIVE_HALF: call <3 x half> @llvm.floor.v3f16( | ||
| // NO_HALF: define noundef <3 x float> @"?test_floor_half3@@YAT?$__vector@$halff@$02@__clang@@T12@@Z"( | ||
| // NO_HALF: call <3 x float> @llvm.floor.v3f32( | ||
| half3 test_floor_half3(half3 p0) { return floor(p0); } | ||
| // NATIVE_HALF: define noundef <4 x half> @ | ||
| // NATIVE_HALF: call <4 x half> @llvm.floor.v4f16( | ||
| // NO_HALF: define noundef <4 x float> @"?test_floor_half4@@YAT?$__vector@$halff@$03@__clang@@T12@@Z"( | ||
| // NO_HALF: call <4 x float> @llvm.floor.v4f32( | ||
| half4 test_floor_half4(half4 p0) { return floor(p0); } | ||
|
|
||
| // CHECK: define noundef float @ | ||
| // CHECK: call float @llvm.floor.f32( | ||
| float test_floor_float(float p0) { return floor(p0); } | ||
| // CHECK: define noundef <2 x float> @ | ||
| // CHECK: call <2 x float> @llvm.floor.v2f32( | ||
| float2 test_floor_float2(float2 p0) { return floor(p0); } | ||
| // CHECK: define noundef <3 x float> @ | ||
| // CHECK: call <3 x float> @llvm.floor.v3f32( | ||
| float3 test_floor_float3(float3 p0) { return floor(p0); } | ||
| // CHECK: define noundef <4 x float> @ | ||
| // CHECK: call <4 x float> @llvm.floor.v4f32( | ||
| float4 test_floor_float4(float4 p0) { return floor(p0); } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,15 @@ | ||
| // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s -fnative-half-type -emit-llvm -disable-llvm-passes -o - | FileCheck %s | ||
|
|
||
| // CHECK-LABEL: builtin_lerp_half_vector | ||
| // CHECK: %hlsl.lerp = call <3 x half> @llvm.dx.lerp.v3f16(<3 x half> %0, <3 x half> %1, <3 x half> %2) | ||
| // CHECK: ret <3 x half> %hlsl.lerp | ||
| half3 builtin_lerp_half_vector (half3 p0) { | ||
| return __builtin_hlsl_lerp ( p0, p0, p0 ); | ||
| } | ||
|
|
||
| // CHECK-LABEL: builtin_lerp_floar_vector | ||
| // CHECK: %hlsl.lerp = call <2 x float> @llvm.dx.lerp.v2f32(<2 x float> %0, <2 x float> %1, <2 x float> %2) | ||
| // CHECK: ret <2 x float> %hlsl.lerp | ||
| float2 builtin_lerp_floar_vector ( float2 p0) { | ||
| return __builtin_hlsl_lerp ( p0, p0, p0 ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,102 +1,102 @@ | ||
| // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ | ||
| // RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ | ||
| // RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ | ||
| // RUN: --check-prefixes=CHECK,DXIL_CHECK,DXIL_NATIVE_HALF,NATIVE_HALF | ||
| // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ | ||
| // RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \ | ||
| // RUN: -o - | FileCheck %s --check-prefixes=CHECK,DXIL_CHECK,NO_HALF,DXIL_NO_HALF | ||
| // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ | ||
| // RUN: spirv-unknown-vulkan-compute %s -fnative-half-type \ | ||
| // RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ | ||
| // RUN: --check-prefixes=CHECK,NATIVE_HALF,SPIR_NATIVE_HALF,SPIR_CHECK | ||
| // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ | ||
| // RUN: spirv-unknown-vulkan-compute %s -emit-llvm -disable-llvm-passes \ | ||
| // RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF,SPIR_NO_HALF,SPIR_CHECK | ||
|
|
||
|
|
||
| // DXIL_NATIVE_HALF: %hlsl.lerp = call half @llvm.dx.lerp.f16(half %0, half %1, half %2) | ||
| // SPIR_NATIVE_HALF: %hlsl.lerp = call half @llvm.spv.lerp.f16(half %0, half %1, half %2) | ||
| // NATIVE_HALF: ret half %hlsl.lerp | ||
| // DXIL_NO_HALF: %hlsl.lerp = call float @llvm.dx.lerp.f32(float %0, float %1, float %2) | ||
| // SPIR_NO_HALF: %hlsl.lerp = call float @llvm.spv.lerp.f32(float %0, float %1, float %2) | ||
| // NO_HALF: ret float %hlsl.lerp | ||
| half test_lerp_half(half p0) { return lerp(p0, p0, p0); } | ||
|
|
||
| // DXIL_NATIVE_HALF: %hlsl.lerp = call <2 x half> @llvm.dx.lerp.v2f16(<2 x half> %0, <2 x half> %1, <2 x half> %2) | ||
| // SPIR_NATIVE_HALF: %hlsl.lerp = call <2 x half> @llvm.spv.lerp.v2f16(<2 x half> %0, <2 x half> %1, <2 x half> %2) | ||
| // NATIVE_HALF: ret <2 x half> %hlsl.lerp | ||
| // DXIL_NO_HALF: %hlsl.lerp = call <2 x float> @llvm.dx.lerp.v2f32(<2 x float> %0, <2 x float> %1, <2 x float> %2) | ||
| // SPIR_NO_HALF: %hlsl.lerp = call <2 x float> @llvm.spv.lerp.v2f32(<2 x float> %0, <2 x float> %1, <2 x float> %2) | ||
| // NO_HALF: ret <2 x float> %hlsl.lerp | ||
| half2 test_lerp_half2(half2 p0) { return lerp(p0, p0, p0); } | ||
|
|
||
| // DXIL_NATIVE_HALF: %hlsl.lerp = call <3 x half> @llvm.dx.lerp.v3f16(<3 x half> %0, <3 x half> %1, <3 x half> %2) | ||
| // SPIR_NATIVE_HALF: %hlsl.lerp = call <3 x half> @llvm.spv.lerp.v3f16(<3 x half> %0, <3 x half> %1, <3 x half> %2) | ||
| // NATIVE_HALF: ret <3 x half> %hlsl.lerp | ||
| // DXIL_NO_HALF: %hlsl.lerp = call <3 x float> @llvm.dx.lerp.v3f32(<3 x float> %0, <3 x float> %1, <3 x float> %2) | ||
| // SPIR_NO_HALF: %hlsl.lerp = call <3 x float> @llvm.spv.lerp.v3f32(<3 x float> %0, <3 x float> %1, <3 x float> %2) | ||
| // NO_HALF: ret <3 x float> %hlsl.lerp | ||
| half3 test_lerp_half3(half3 p0) { return lerp(p0, p0, p0); } | ||
|
|
||
| // DXIL_NATIVE_HALF: %hlsl.lerp = call <4 x half> @llvm.dx.lerp.v4f16(<4 x half> %0, <4 x half> %1, <4 x half> %2) | ||
| // SPIR_NATIVE_HALF: %hlsl.lerp = call <4 x half> @llvm.spv.lerp.v4f16(<4 x half> %0, <4 x half> %1, <4 x half> %2) | ||
| // NATIVE_HALF: ret <4 x half> %hlsl.lerp | ||
| // DXIL_NO_HALF: %hlsl.lerp = call <4 x float> @llvm.dx.lerp.v4f32(<4 x float> %0, <4 x float> %1, <4 x float> %2) | ||
| // SPIR_NO_HALF: %hlsl.lerp = call <4 x float> @llvm.spv.lerp.v4f32(<4 x float> %0, <4 x float> %1, <4 x float> %2) | ||
| // NO_HALF: ret <4 x float> %hlsl.lerp | ||
| half4 test_lerp_half4(half4 p0) { return lerp(p0, p0, p0); } | ||
|
|
||
| // DXIL_CHECK: %hlsl.lerp = call float @llvm.dx.lerp.f32(float %0, float %1, float %2) | ||
| // SPIR_CHECK: %hlsl.lerp = call float @llvm.spv.lerp.f32(float %0, float %1, float %2) | ||
| // CHECK: ret float %hlsl.lerp | ||
| float test_lerp_float(float p0) { return lerp(p0, p0, p0); } | ||
|
|
||
| // DXIL_CHECK: %hlsl.lerp = call <2 x float> @llvm.dx.lerp.v2f32(<2 x float> %0, <2 x float> %1, <2 x float> %2) | ||
| // SPIR_CHECK: %hlsl.lerp = call <2 x float> @llvm.spv.lerp.v2f32(<2 x float> %0, <2 x float> %1, <2 x float> %2) | ||
| // CHECK: ret <2 x float> %hlsl.lerp | ||
| float2 test_lerp_float2(float2 p0) { return lerp(p0, p0, p0); } | ||
|
|
||
| // DXIL_CHECK: %hlsl.lerp = call <3 x float> @llvm.dx.lerp.v3f32(<3 x float> %0, <3 x float> %1, <3 x float> %2) | ||
| // SPIR_CHECK: %hlsl.lerp = call <3 x float> @llvm.spv.lerp.v3f32(<3 x float> %0, <3 x float> %1, <3 x float> %2) | ||
| // CHECK: ret <3 x float> %hlsl.lerp | ||
| float3 test_lerp_float3(float3 p0) { return lerp(p0, p0, p0); } | ||
|
|
||
| // DXIL_CHECK: %hlsl.lerp = call <4 x float> @llvm.dx.lerp.v4f32(<4 x float> %0, <4 x float> %1, <4 x float> %2) | ||
| // SPIR_CHECK: %hlsl.lerp = call <4 x float> @llvm.spv.lerp.v4f32(<4 x float> %0, <4 x float> %1, <4 x float> %2) | ||
| // CHECK: ret <4 x float> %hlsl.lerp | ||
| float4 test_lerp_float4(float4 p0) { return lerp(p0, p0, p0); } | ||
|
|
||
| // DXIL_CHECK: %hlsl.lerp = call <2 x float> @llvm.dx.lerp.v2f32(<2 x float> %splat.splat, <2 x float> %1, <2 x float> %2) | ||
| // SPIR_CHECK: %hlsl.lerp = call <2 x float> @llvm.spv.lerp.v2f32(<2 x float> %splat.splat, <2 x float> %1, <2 x float> %2) | ||
| // CHECK: ret <2 x float> %hlsl.lerp | ||
| float2 test_lerp_float2_splat(float p0, float2 p1) { return lerp(p0, p1, p1); } | ||
|
|
||
| // DXIL_CHECK: %hlsl.lerp = call <3 x float> @llvm.dx.lerp.v3f32(<3 x float> %splat.splat, <3 x float> %1, <3 x float> %2) | ||
| // SPIR_CHECK: %hlsl.lerp = call <3 x float> @llvm.spv.lerp.v3f32(<3 x float> %splat.splat, <3 x float> %1, <3 x float> %2) | ||
| // CHECK: ret <3 x float> %hlsl.lerp | ||
| float3 test_lerp_float3_splat(float p0, float3 p1) { return lerp(p0, p1, p1); } | ||
|
|
||
| // DXIL_CHECK: %hlsl.lerp = call <4 x float> @llvm.dx.lerp.v4f32(<4 x float> %splat.splat, <4 x float> %1, <4 x float> %2) | ||
| // SPIR_CHECK: %hlsl.lerp = call <4 x float> @llvm.spv.lerp.v4f32(<4 x float> %splat.splat, <4 x float> %1, <4 x float> %2) | ||
| // CHECK: ret <4 x float> %hlsl.lerp | ||
| float4 test_lerp_float4_splat(float p0, float4 p1) { return lerp(p0, p1, p1); } | ||
|
|
||
| // CHECK: %conv = sitofp i32 %2 to float | ||
| // CHECK: %splat.splatinsert = insertelement <2 x float> poison, float %conv, i64 0 | ||
| // CHECK: %splat.splat = shufflevector <2 x float> %splat.splatinsert, <2 x float> poison, <2 x i32> zeroinitializer | ||
| // DXIL_CHECK: %hlsl.lerp = call <2 x float> @llvm.dx.lerp.v2f32(<2 x float> %0, <2 x float> %1, <2 x float> %splat.splat) | ||
| // SPIR_CHECK: %hlsl.lerp = call <2 x float> @llvm.spv.lerp.v2f32(<2 x float> %0, <2 x float> %1, <2 x float> %splat.splat) | ||
| // CHECK: ret <2 x float> %hlsl.lerp | ||
| float2 test_lerp_float2_int_splat(float2 p0, int p1) { | ||
| return lerp(p0, p0, p1); | ||
| } | ||
|
|
||
| // CHECK: %conv = sitofp i32 %2 to float | ||
| // CHECK: %splat.splatinsert = insertelement <3 x float> poison, float %conv, i64 0 | ||
| // CHECK: %splat.splat = shufflevector <3 x float> %splat.splatinsert, <3 x float> poison, <3 x i32> zeroinitializer | ||
| // DXIL_CHECK: %hlsl.lerp = call <3 x float> @llvm.dx.lerp.v3f32(<3 x float> %0, <3 x float> %1, <3 x float> %splat.splat) | ||
| // SPIR_CHECK: %hlsl.lerp = call <3 x float> @llvm.spv.lerp.v3f32(<3 x float> %0, <3 x float> %1, <3 x float> %splat.splat) | ||
| // CHECK: ret <3 x float> %hlsl.lerp | ||
| float3 test_lerp_float3_int_splat(float3 p0, int p1) { | ||
| return lerp(p0, p0, p1); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,41 +1,41 @@ | ||
| // RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \ | ||
| // RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ | ||
| // RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ | ||
| // RUN: --check-prefixes=CHECK,NATIVE_HALF | ||
| // RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \ | ||
| // RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \ | ||
| // RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF | ||
|
|
||
| // NATIVE_HALF: define noundef half @ | ||
| // NATIVE_HALF: call half @llvm.log.f16( | ||
| // NO_HALF: define noundef float @"?test_log_half@@YA$halff@$halff@@Z"( | ||
| // NO_HALF: call float @llvm.log.f32( | ||
| half test_log_half(half p0) { return log(p0); } | ||
| // NATIVE_HALF: define noundef <2 x half> @ | ||
| // NATIVE_HALF: call <2 x half> @llvm.log.v2f16 | ||
| // NO_HALF: define noundef <2 x float> @"?test_log_half2 | ||
| // NO_HALF: call <2 x float> @llvm.log.v2f32( | ||
| half2 test_log_half2(half2 p0) { return log(p0); } | ||
| // NATIVE_HALF: define noundef <3 x half> @ | ||
| // NATIVE_HALF: call <3 x half> @llvm.log.v3f16 | ||
| // NO_HALF: define noundef <3 x float> @"?test_log_half3 | ||
| // NO_HALF: call <3 x float> @llvm.log.v3f32( | ||
| half3 test_log_half3(half3 p0) { return log(p0); } | ||
| // NATIVE_HALF: define noundef <4 x half> @ | ||
| // NATIVE_HALF: call <4 x half> @llvm.log.v4f16 | ||
| // NO_HALF: define noundef <4 x float> @"?test_log_half4 | ||
| // NO_HALF: call <4 x float> @llvm.log.v4f32( | ||
| half4 test_log_half4(half4 p0) { return log(p0); } | ||
|
|
||
| // CHECK: define noundef float @"?test_log_float | ||
| // CHECK: call float @llvm.log.f32( | ||
| float test_log_float(float p0) { return log(p0); } | ||
| // CHECK: define noundef <2 x float> @"?test_log_float2 | ||
| // CHECK: call <2 x float> @llvm.log.v2f32 | ||
| float2 test_log_float2(float2 p0) { return log(p0); } | ||
| // CHECK: define noundef <3 x float> @"?test_log_float3 | ||
| // CHECK: call <3 x float> @llvm.log.v3f32 | ||
| float3 test_log_float3(float3 p0) { return log(p0); } | ||
| // CHECK: define noundef <4 x float> @"?test_log_float4 | ||
| // CHECK: call <4 x float> @llvm.log.v4f32 | ||
| float4 test_log_float4(float4 p0) { return log(p0); } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,41 +1,41 @@ | ||
| // RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \ | ||
| // RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ | ||
| // RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ | ||
| // RUN: --check-prefixes=CHECK,NATIVE_HALF | ||
| // RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \ | ||
| // RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \ | ||
| // RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF | ||
|
|
||
| // NATIVE_HALF: define noundef half @ | ||
| // NATIVE_HALF: call half @llvm.log2.f16( | ||
| // NO_HALF: define noundef float @"?test_log2_half | ||
| // NO_HALF: call float @llvm.log2.f32( | ||
| half test_log2_half(half p0) { return log2(p0); } | ||
| // NATIVE_HALF: define noundef <2 x half> @ | ||
| // NATIVE_HALF: call <2 x half> @llvm.log2.v2f16 | ||
| // NO_HALF: define noundef <2 x float> @"?test_log2_half2 | ||
| // NO_HALF: call <2 x float> @llvm.log2.v2f32( | ||
| half2 test_log2_half2(half2 p0) { return log2(p0); } | ||
| // NATIVE_HALF: define noundef <3 x half> @ | ||
| // NATIVE_HALF: call <3 x half> @llvm.log2.v3f16 | ||
| // NO_HALF: define noundef <3 x float> @"?test_log2_half3 | ||
| // NO_HALF: call <3 x float> @llvm.log2.v3f32( | ||
| half3 test_log2_half3(half3 p0) { return log2(p0); } | ||
| // NATIVE_HALF: define noundef <4 x half> @ | ||
| // NATIVE_HALF: call <4 x half> @llvm.log2.v4f16 | ||
| // NO_HALF: define noundef <4 x float> @"?test_log2_half4 | ||
| // NO_HALF: call <4 x float> @llvm.log2.v4f32( | ||
| half4 test_log2_half4(half4 p0) { return log2(p0); } | ||
|
|
||
| // CHECK: define noundef float @"?test_log2_float | ||
| // CHECK: call float @llvm.log2.f32( | ||
| float test_log2_float(float p0) { return log2(p0); } | ||
| // CHECK: define noundef <2 x float> @"?test_log2_float2 | ||
| // CHECK: call <2 x float> @llvm.log2.v2f32 | ||
| float2 test_log2_float2(float2 p0) { return log2(p0); } | ||
| // CHECK: define noundef <3 x float> @"?test_log2_float3 | ||
| // CHECK: call <3 x float> @llvm.log2.v3f32 | ||
| float3 test_log2_float3(float3 p0) { return log2(p0); } | ||
| // CHECK: define noundef <4 x float> @"?test_log2_float4 | ||
| // CHECK: call <4 x float> @llvm.log2.v4f32 | ||
| float4 test_log2_float4(float4 p0) { return log2(p0); } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,134 +1,134 @@ | ||
| // RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \ | ||
| // RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ | ||
| // RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ | ||
| // RUN: --check-prefixes=CHECK,NATIVE_HALF | ||
| // RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \ | ||
| // RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \ | ||
| // RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF | ||
|
|
||
| #ifdef __HLSL_ENABLE_16_BIT | ||
| // NATIVE_HALF: define noundef i16 @ | ||
| // NATIVE_HALF: call i16 @llvm.smax.i16( | ||
| int16_t test_max_short(int16_t p0, int16_t p1) { return max(p0, p1); } | ||
| // NATIVE_HALF: define noundef <2 x i16> @ | ||
| // NATIVE_HALF: call <2 x i16> @llvm.smax.v2i16( | ||
| int16_t2 test_max_short2(int16_t2 p0, int16_t2 p1) { return max(p0, p1); } | ||
| // NATIVE_HALF: define noundef <3 x i16> @ | ||
| // NATIVE_HALF: call <3 x i16> @llvm.smax.v3i16 | ||
| int16_t3 test_max_short3(int16_t3 p0, int16_t3 p1) { return max(p0, p1); } | ||
| // NATIVE_HALF: define noundef <4 x i16> @ | ||
| // NATIVE_HALF: call <4 x i16> @llvm.smax.v4i16 | ||
| int16_t4 test_max_short4(int16_t4 p0, int16_t4 p1) { return max(p0, p1); } | ||
|
|
||
| // NATIVE_HALF: define noundef i16 @ | ||
| // NATIVE_HALF: call i16 @llvm.umax.i16( | ||
| uint16_t test_max_ushort(uint16_t p0, uint16_t p1) { return max(p0, p1); } | ||
| // NATIVE_HALF: define noundef <2 x i16> @ | ||
| // NATIVE_HALF: call <2 x i16> @llvm.umax.v2i16 | ||
| uint16_t2 test_max_ushort2(uint16_t2 p0, uint16_t2 p1) { return max(p0, p1); } | ||
| // NATIVE_HALF: define noundef <3 x i16> @ | ||
| // NATIVE_HALF: call <3 x i16> @llvm.umax.v3i16 | ||
| uint16_t3 test_max_ushort3(uint16_t3 p0, uint16_t3 p1) { return max(p0, p1); } | ||
| // NATIVE_HALF: define noundef <4 x i16> @ | ||
| // NATIVE_HALF: call <4 x i16> @llvm.umax.v4i16 | ||
| uint16_t4 test_max_ushort4(uint16_t4 p0, uint16_t4 p1) { return max(p0, p1); } | ||
| #endif | ||
|
|
||
| // CHECK: define noundef i32 @ | ||
| // CHECK: call i32 @llvm.smax.i32( | ||
| int test_max_int(int p0, int p1) { return max(p0, p1); } | ||
| // CHECK: define noundef <2 x i32> @ | ||
| // CHECK: call <2 x i32> @llvm.smax.v2i32 | ||
| int2 test_max_int2(int2 p0, int2 p1) { return max(p0, p1); } | ||
| // CHECK: define noundef <3 x i32> @ | ||
| // CHECK: call <3 x i32> @llvm.smax.v3i32 | ||
| int3 test_max_int3(int3 p0, int3 p1) { return max(p0, p1); } | ||
| // CHECK: define noundef <4 x i32> @ | ||
| // CHECK: call <4 x i32> @llvm.smax.v4i32 | ||
| int4 test_max_int4(int4 p0, int4 p1) { return max(p0, p1); } | ||
|
|
||
| // CHECK: define noundef i32 @ | ||
| // CHECK: call i32 @llvm.umax.i32( | ||
| int test_max_uint(uint p0, uint p1) { return max(p0, p1); } | ||
| // CHECK: define noundef <2 x i32> @ | ||
| // CHECK: call <2 x i32> @llvm.umax.v2i32 | ||
| uint2 test_max_uint2(uint2 p0, uint2 p1) { return max(p0, p1); } | ||
| // CHECK: define noundef <3 x i32> @ | ||
| // CHECK: call <3 x i32> @llvm.umax.v3i32 | ||
| uint3 test_max_uint3(uint3 p0, uint3 p1) { return max(p0, p1); } | ||
| // CHECK: define noundef <4 x i32> @ | ||
| // CHECK: call <4 x i32> @llvm.umax.v4i32 | ||
| uint4 test_max_uint4(uint4 p0, uint4 p1) { return max(p0, p1); } | ||
|
|
||
| // CHECK: define noundef i64 @ | ||
| // CHECK: call i64 @llvm.smax.i64( | ||
| int64_t test_max_long(int64_t p0, int64_t p1) { return max(p0, p1); } | ||
| // CHECK: define noundef <2 x i64> @ | ||
| // CHECK: call <2 x i64> @llvm.smax.v2i64 | ||
| int64_t2 test_max_long2(int64_t2 p0, int64_t2 p1) { return max(p0, p1); } | ||
| // CHECK: define noundef <3 x i64> @ | ||
| // CHECK: call <3 x i64> @llvm.smax.v3i64 | ||
| int64_t3 test_max_long3(int64_t3 p0, int64_t3 p1) { return max(p0, p1); } | ||
| // CHECK: define noundef <4 x i64> @ | ||
| // CHECK: call <4 x i64> @llvm.smax.v4i64 | ||
| int64_t4 test_max_long4(int64_t4 p0, int64_t4 p1) { return max(p0, p1); } | ||
|
|
||
| // CHECK: define noundef i64 @ | ||
| // CHECK: call i64 @llvm.umax.i64( | ||
| uint64_t test_max_long(uint64_t p0, uint64_t p1) { return max(p0, p1); } | ||
| // CHECK: define noundef <2 x i64> @ | ||
| // CHECK: call <2 x i64> @llvm.umax.v2i64 | ||
| uint64_t2 test_max_long2(uint64_t2 p0, uint64_t2 p1) { return max(p0, p1); } | ||
| // CHECK: define noundef <3 x i64> @ | ||
| // CHECK: call <3 x i64> @llvm.umax.v3i64 | ||
| uint64_t3 test_max_long3(uint64_t3 p0, uint64_t3 p1) { return max(p0, p1); } | ||
| // CHECK: define noundef <4 x i64> @ | ||
| // CHECK: call <4 x i64> @llvm.umax.v4i64 | ||
| uint64_t4 test_max_long4(uint64_t4 p0, uint64_t4 p1) { return max(p0, p1); } | ||
|
|
||
| // NATIVE_HALF: define noundef half @ | ||
| // NATIVE_HALF: call half @llvm.maxnum.f16( | ||
| // NO_HALF: define noundef float @"?test_max_half | ||
| // NO_HALF: call float @llvm.maxnum.f32( | ||
| half test_max_half(half p0, half p1) { return max(p0, p1); } | ||
| // NATIVE_HALF: define noundef <2 x half> @ | ||
| // NATIVE_HALF: call <2 x half> @llvm.maxnum.v2f16 | ||
| // NO_HALF: define noundef <2 x float> @"?test_max_half2 | ||
| // NO_HALF: call <2 x float> @llvm.maxnum.v2f32( | ||
| half2 test_max_half2(half2 p0, half2 p1) { return max(p0, p1); } | ||
| // NATIVE_HALF: define noundef <3 x half> @ | ||
| // NATIVE_HALF: call <3 x half> @llvm.maxnum.v3f16 | ||
| // NO_HALF: define noundef <3 x float> @"?test_max_half3 | ||
| // NO_HALF: call <3 x float> @llvm.maxnum.v3f32( | ||
| half3 test_max_half3(half3 p0, half3 p1) { return max(p0, p1); } | ||
| // NATIVE_HALF: define noundef <4 x half> @ | ||
| // NATIVE_HALF: call <4 x half> @llvm.maxnum.v4f16 | ||
| // NO_HALF: define noundef <4 x float> @"?test_max_half4 | ||
| // NO_HALF: call <4 x float> @llvm.maxnum.v4f32( | ||
| half4 test_max_half4(half4 p0, half4 p1) { return max(p0, p1); } | ||
|
|
||
| // CHECK: define noundef float @"?test_max_float | ||
| // CHECK: call float @llvm.maxnum.f32( | ||
| float test_max_float(float p0, float p1) { return max(p0, p1); } | ||
| // CHECK: define noundef <2 x float> @"?test_max_float2 | ||
| // CHECK: call <2 x float> @llvm.maxnum.v2f32 | ||
| float2 test_max_float2(float2 p0, float2 p1) { return max(p0, p1); } | ||
| // CHECK: define noundef <3 x float> @"?test_max_float3 | ||
| // CHECK: call <3 x float> @llvm.maxnum.v3f32 | ||
| float3 test_max_float3(float3 p0, float3 p1) { return max(p0, p1); } | ||
| // CHECK: define noundef <4 x float> @"?test_max_float4 | ||
| // CHECK: call <4 x float> @llvm.maxnum.v4f32 | ||
| float4 test_max_float4(float4 p0, float4 p1) { return max(p0, p1); } | ||
|
|
||
| // CHECK: define noundef double @ | ||
| // CHECK: call double @llvm.maxnum.f64( | ||
| double test_max_double(double p0, double p1) { return max(p0, p1); } | ||
| // CHECK: define noundef <2 x double> @ | ||
| // CHECK: call <2 x double> @llvm.maxnum.v2f64 | ||
| double2 test_max_double2(double2 p0, double2 p1) { return max(p0, p1); } | ||
| // CHECK: define noundef <3 x double> @ | ||
| // CHECK: call <3 x double> @llvm.maxnum.v3f64 | ||
| double3 test_max_double3(double3 p0, double3 p1) { return max(p0, p1); } | ||
| // CHECK: define noundef <4 x double> @ | ||
| // CHECK: call <4 x double> @llvm.maxnum.v4f64 | ||
| double4 test_max_double4(double4 p0, double4 p1) { return max(p0, p1); } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,41 +1,41 @@ | ||
| // RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \ | ||
| // RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ | ||
| // RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ | ||
| // RUN: --check-prefixes=CHECK,NATIVE_HALF | ||
| // RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \ | ||
| // RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \ | ||
| // RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF | ||
|
|
||
| // NATIVE_HALF: define noundef half @ | ||
| // NATIVE_HALF: call half @llvm.pow.f16( | ||
| // NO_HALF: define noundef float @"?test_pow_half | ||
| // NO_HALF: call float @llvm.pow.f32( | ||
| half test_pow_half(half p0, half p1) { return pow(p0, p1); } | ||
| // NATIVE_HALF: define noundef <2 x half> @"?test_pow_half2 | ||
| // NATIVE_HALF: call <2 x half> @llvm.pow.v2f16 | ||
| // NO_HALF: define noundef <2 x float> @"?test_pow_half2 | ||
| // NO_HALF: call <2 x float> @llvm.pow.v2f32( | ||
| half2 test_pow_half2(half2 p0, half2 p1) { return pow(p0, p1); } | ||
| // NATIVE_HALF: define noundef <3 x half> @"?test_pow_half3 | ||
| // NATIVE_HALF: call <3 x half> @llvm.pow.v3f16 | ||
| // NO_HALF: define noundef <3 x float> @"?test_pow_half3 | ||
| // NO_HALF: call <3 x float> @llvm.pow.v3f32( | ||
| half3 test_pow_half3(half3 p0, half3 p1) { return pow(p0, p1); } | ||
| // NATIVE_HALF: define noundef <4 x half> @"?test_pow_half4 | ||
| // NATIVE_HALF: call <4 x half> @llvm.pow.v4f16 | ||
| // NO_HALF: define noundef <4 x float> @"?test_pow_half4 | ||
| // NO_HALF: call <4 x float> @llvm.pow.v4f32( | ||
| half4 test_pow_half4(half4 p0, half4 p1) { return pow(p0, p1); } | ||
|
|
||
| // CHECK: define noundef float @"?test_pow_float | ||
| // CHECK: call float @llvm.pow.f32( | ||
| float test_pow_float(float p0, float p1) { return pow(p0, p1); } | ||
| // CHECK: define noundef <2 x float> @"?test_pow_float2 | ||
| // CHECK: call <2 x float> @llvm.pow.v2f32 | ||
| float2 test_pow_float2(float2 p0, float2 p1) { return pow(p0, p1); } | ||
| // CHECK: define noundef <3 x float> @"?test_pow_float3 | ||
| // CHECK: call <3 x float> @llvm.pow.v3f32 | ||
| float3 test_pow_float3(float3 p0, float3 p1) { return pow(p0, p1); } | ||
| // CHECK: define noundef <4 x float> @"?test_pow_float4 | ||
| // CHECK: call <4 x float> @llvm.pow.v4f32 | ||
| float4 test_pow_float4(float4 p0, float4 p1) { return pow(p0, p1); } |