Skip to content

Commit 04f7ecb

Browse files
committed
Fix clang format issue
Signed-off-by: gejin <[email protected]>
1 parent b80f10f commit 04f7ecb

File tree

2 files changed

+93
-69
lines changed

2 files changed

+93
-69
lines changed
Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// RUN: %clang_cc1 -fsycl -fsycl-is-device -fsyntax-only -Wno-sycl-2017-compat -verify %s
2-
extern "C" float sinf(float);
3-
extern "C" float cosf(float);
4-
extern "C" float floorf(float);
5-
extern "C" float logf(float);
6-
extern "C" float nearbyintf(float);
7-
extern "C" float rintf(float);
8-
extern "C" float roundf(float);
9-
extern "C" float truncf(float);
10-
extern "C" float copysignf(float, float);
2+
extern "C" float sinf(float);
3+
extern "C" float cosf(float);
4+
extern "C" float floorf(float);
5+
extern "C" float logf(float);
6+
extern "C" float nearbyintf(float);
7+
extern "C" float rintf(float);
8+
extern "C" float roundf(float);
9+
extern "C" float truncf(float);
10+
extern "C" float copysignf(float, float);
1111
extern "C" double sin(double);
1212
extern "C" double cos(double);
1313
extern "C" double floor(double);
@@ -26,42 +26,42 @@ int main() {
2626
kernel<class kernel_function>([=]() {
2727
int acc[1] = {5};
2828
acc[0] *= 2;
29-
acc[0] += (int)truncf(1.0f); // expected-no-error
30-
acc[0] += (int)trunc(1.0); // expected-no-error
31-
acc[0] += (int)roundf(1.0f); // expected-no-error
32-
acc[0] += (int)round(1.0); // expected-no-error
33-
acc[0] += (int)rintf(1.0f); // expected-no-error
34-
acc[0] += (int)rint(1.0); // expected-no-error
35-
acc[0] += (int)nearbyintf(0.5f); // expected-no-error
36-
acc[0] += (int)nearbyint(0.5); // expected-no-error
37-
acc[0] += (int)floorf(0.5f); // expected-no-error
38-
acc[0] += (int)floor(0.5); // expected-no-error
39-
acc[0] += (int)copysignf(1.0f, -0.5f); // expected-no-error
40-
acc[0] += (int)copysign(1.0, -0.5); // expected-no-error
41-
acc[0] += (int)sinf(1.0f); // expected-no-error
42-
acc[0] += (int)sin(1.0); // expected-no-error
43-
acc[0] += (int)__builtin_sinf(1.0f); // expected-no-error
44-
acc[0] += (int)__builtin_sin(1.0); // expected-no-error
45-
acc[0] += (int)cosf(1.0f); // expected-no-error
46-
acc[0] += (int)cos(1.0); // expected-no-error
47-
acc[0] += (int)__builtin_cosf(1.0f); // expected-no-error
48-
acc[0] += (int)__builtin_cos(1.0); // expected-no-error
49-
acc[0] += (int)logf(1.0f); // expected-no-error
50-
acc[0] += (int)log(1.0); // expected-no-error
51-
acc[0] += (int)__builtin_truncf(1.0f); // expected-no-error
52-
acc[0] += (int)__builtin_trunc(1.0); // expected-no-error
53-
acc[0] += (int)__builtin_rintf(1.0f); // expected-no-error
54-
acc[0] += (int)__builtin_rint(1.0); // expected-no-error
55-
acc[0] += (int)__builtin_nearbyintf(0.5f); // expected-no-error
56-
acc[0] += (int)__builtin_nearbyint(0.5); // expected-no-error
57-
acc[0] += (int)__builtin_floorf(0.5f); // expected-no-error
58-
acc[0] += (int)__builtin_floor(0.5); // expected-no-error
59-
acc[0] += (int)__builtin_copysignf(1.0f, -0.5f); // expected-no-error
60-
acc[0] += (int)__builtin_logf(1.0f); // expected-no-error
61-
acc[0] += (int)__builtin_log(1.0); // expected-no-error
62-
acc[0] += (int)__builtin_fabsl(-1.0); // expected-error{{builtin is not supported on this target}}
63-
acc[0] += (int)__builtin_cosl(-1.0); // expected-error{{builtin is not supported on this target}}
64-
acc[0] += (int)__builtin_powl(-1.0, 10.0); // expected-error{{builtin is not supported on this target}}
29+
acc[0] += (int)truncf(1.0f); // expected-no-error
30+
acc[0] += (int)trunc(1.0); // expected-no-error
31+
acc[0] += (int)roundf(1.0f); // expected-no-error
32+
acc[0] += (int)round(1.0); // expected-no-error
33+
acc[0] += (int)rintf(1.0f); // expected-no-error
34+
acc[0] += (int)rint(1.0); // expected-no-error
35+
acc[0] += (int)nearbyintf(0.5f); // expected-no-error
36+
acc[0] += (int)nearbyint(0.5); // expected-no-error
37+
acc[0] += (int)floorf(0.5f); // expected-no-error
38+
acc[0] += (int)floor(0.5); // expected-no-error
39+
acc[0] += (int)copysignf(1.0f, -0.5f); // expected-no-error
40+
acc[0] += (int)copysign(1.0, -0.5); // expected-no-error
41+
acc[0] += (int)sinf(1.0f); // expected-no-error
42+
acc[0] += (int)sin(1.0); // expected-no-error
43+
acc[0] += (int)__builtin_sinf(1.0f); // expected-no-error
44+
acc[0] += (int)__builtin_sin(1.0); // expected-no-error
45+
acc[0] += (int)cosf(1.0f); // expected-no-error
46+
acc[0] += (int)cos(1.0); // expected-no-error
47+
acc[0] += (int)__builtin_cosf(1.0f); // expected-no-error
48+
acc[0] += (int)__builtin_cos(1.0); // expected-no-error
49+
acc[0] += (int)logf(1.0f); // expected-no-error
50+
acc[0] += (int)log(1.0); // expected-no-error
51+
acc[0] += (int)__builtin_truncf(1.0f); // expected-no-error
52+
acc[0] += (int)__builtin_trunc(1.0); // expected-no-error
53+
acc[0] += (int)__builtin_rintf(1.0f); // expected-no-error
54+
acc[0] += (int)__builtin_rint(1.0); // expected-no-error
55+
acc[0] += (int)__builtin_nearbyintf(0.5f); // expected-no-error
56+
acc[0] += (int)__builtin_nearbyint(0.5); // expected-no-error
57+
acc[0] += (int)__builtin_floorf(0.5f); // expected-no-error
58+
acc[0] += (int)__builtin_floor(0.5); // expected-no-error
59+
acc[0] += (int)__builtin_copysignf(1.0f, -0.5f); // expected-no-error
60+
acc[0] += (int)__builtin_logf(1.0f); // expected-no-error
61+
acc[0] += (int)__builtin_log(1.0); // expected-no-error
62+
acc[0] += (int)__builtin_fabsl(-1.0); // expected-error{{builtin is not supported on this target}}
63+
acc[0] += (int)__builtin_cosl(-1.0); // expected-error{{builtin is not supported on this target}}
64+
acc[0] += (int)__builtin_powl(-1.0, 10.0); // expected-error{{builtin is not supported on this target}}
6565
});
6666
return 0;
6767
}

llvm-spirv/lib/SPIRV/SPIRVWriter.cpp

Lines changed: 48 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2126,30 +2126,54 @@ static SPIRVWord getBuiltinIdForIntrinsic(Intrinsic::ID IID) {
21262126
// and assume that the operations have no side effects (FP status flags
21272127
// aren't maintained), so the OpenCL builtin behavior should be
21282128
// acceptable.
2129-
case Intrinsic::ceil: return OpenCLLIB::Ceil;
2130-
case Intrinsic::copysign: return OpenCLLIB::Copysign;
2131-
case Intrinsic::cos: return OpenCLLIB::Cos;
2132-
case Intrinsic::exp: return OpenCLLIB::Exp;
2133-
case Intrinsic::exp2: return OpenCLLIB::Exp2;
2134-
case Intrinsic::fabs: return OpenCLLIB::Fabs;
2135-
case Intrinsic::floor: return OpenCLLIB::Floor;
2136-
case Intrinsic::fma: return OpenCLLIB::Fma;
2137-
case Intrinsic::log: return OpenCLLIB::Log;
2138-
case Intrinsic::log10: return OpenCLLIB::Log10;
2139-
case Intrinsic::log2: return OpenCLLIB::Log2;
2140-
case Intrinsic::maximum: return OpenCLLIB::Fmax;
2141-
case Intrinsic::maxnum: return OpenCLLIB::Fmax;
2142-
case Intrinsic::minimum: return OpenCLLIB::Fmin;
2143-
case Intrinsic::minnum: return OpenCLLIB::Fmin;
2144-
case Intrinsic::nearbyint: return OpenCLLIB::Rint;
2145-
case Intrinsic::pow: return OpenCLLIB::Pow;
2146-
case Intrinsic::powi: return OpenCLLIB::Pown;
2147-
case Intrinsic::rint: return OpenCLLIB::Rint;
2148-
case Intrinsic::round: return OpenCLLIB::Round;
2149-
case Intrinsic::roundeven: return OpenCLLIB::Rint;
2150-
case Intrinsic::sin: return OpenCLLIB::Sin;
2151-
case Intrinsic::sqrt: return OpenCLLIB::Sqrt;
2152-
case Intrinsic::trunc: return OpenCLLIB::Trunc;
2129+
case Intrinsic::ceil:
2130+
return OpenCLLIB::Ceil;
2131+
case Intrinsic::copysign:
2132+
return OpenCLLIB::Copysign;
2133+
case Intrinsic::cos:
2134+
return OpenCLLIB::Cos;
2135+
case Intrinsic::exp:
2136+
return OpenCLLIB::Exp;
2137+
case Intrinsic::exp2:
2138+
return OpenCLLIB::Exp2;
2139+
case Intrinsic::fabs:
2140+
return OpenCLLIB::Fabs;
2141+
case Intrinsic::floor:
2142+
return OpenCLLIB::Floor;
2143+
case Intrinsic::fma:
2144+
return OpenCLLIB::Fma;
2145+
case Intrinsic::log:
2146+
return OpenCLLIB::Log;
2147+
case Intrinsic::log10:
2148+
return OpenCLLIB::Log10;
2149+
case Intrinsic::log2:
2150+
return OpenCLLIB::Log2;
2151+
case Intrinsic::maximum:
2152+
return OpenCLLIB::Fmax;
2153+
case Intrinsic::maxnum:
2154+
return OpenCLLIB::Fmax;
2155+
case Intrinsic::minimum:
2156+
return OpenCLLIB::Fmin;
2157+
case Intrinsic::minnum:
2158+
return OpenCLLIB::Fmin;
2159+
case Intrinsic::nearbyint:
2160+
return OpenCLLIB::Rint;
2161+
case Intrinsic::pow:
2162+
return OpenCLLIB::Pow;
2163+
case Intrinsic::powi:
2164+
return OpenCLLIB::Pown;
2165+
case Intrinsic::rint:
2166+
return OpenCLLIB::Rint;
2167+
case Intrinsic::round:
2168+
return OpenCLLIB::Round;
2169+
case Intrinsic::roundeven:
2170+
return OpenCLLIB::Rint;
2171+
case Intrinsic::sin:
2172+
return OpenCLLIB::Sin;
2173+
case Intrinsic::sqrt:
2174+
return OpenCLLIB::Sqrt;
2175+
case Intrinsic::trunc:
2176+
return OpenCLLIB::Trunc;
21532177
default:
21542178
assert(false && "Builtin ID requested for Unhandled intrinsic!");
21552179
return 0;

0 commit comments

Comments
 (0)