Skip to content

Commit 316cd8b

Browse files
aratajewigcbot
authored andcommitted
Implement support for both SPV-IR forms of OpLessOrGreater, OpOrdered
and OpUnordered builtins
1 parent ebaeab5 commit 316cd8b

File tree

6 files changed

+150
-88
lines changed

6 files changed

+150
-88
lines changed

IGC/BiFModule/Headers/spirv.h

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -3749,67 +3749,67 @@ __bool8 __builtin_spirv_OpSignBitSet_v8f64(double8 x);
37493749
__bool16 __builtin_spirv_OpSignBitSet_v16f64(double16 x);
37503750
#endif // defined(cl_khr_fp64)
37513751

3752-
bool __builtin_spirv_OpLessOrGreater_f16_f16(half x, half y);
3753-
bool __builtin_spirv_OpLessOrGreater_f32_f32(float x, float y);
3754-
__bool2 __builtin_spirv_OpLessOrGreater_v2f16_v2f16(half2 x, half2 y);
3755-
__bool2 __builtin_spirv_OpLessOrGreater_v2f32_v2f32(float2 x, float2 y);
3756-
__bool3 __builtin_spirv_OpLessOrGreater_v3f16_v3f16(half3 x, half3 y);
3757-
__bool3 __builtin_spirv_OpLessOrGreater_v3f32_v3f32(float3 x, float3 y);
3758-
__bool4 __builtin_spirv_OpLessOrGreater_v4f16_v4f16(half4 x, half4 y);
3759-
__bool4 __builtin_spirv_OpLessOrGreater_v4f32_v4f32(float4 x, float4 y);
3760-
__bool8 __builtin_spirv_OpLessOrGreater_v8f16_v8f16(half8 x, half8 y);
3761-
__bool8 __builtin_spirv_OpLessOrGreater_v8f32_v8f32(float8 x, float8 y);
3762-
__bool16 __builtin_spirv_OpLessOrGreater_v16f16_v16f16(half16 x, half16 y);
3763-
__bool16 __builtin_spirv_OpLessOrGreater_v16f32_v16f32(float16 x, float16 y);
3764-
#if defined(cl_khr_fp64)
3765-
bool __builtin_spirv_OpLessOrGreater_f64_f64(double x, double y);
3766-
__bool2 __builtin_spirv_OpLessOrGreater_v2f64_v2f64(double2 x, double2 y);
3767-
__bool3 __builtin_spirv_OpLessOrGreater_v3f64_v3f64(double3 x, double3 y);
3768-
__bool4 __builtin_spirv_OpLessOrGreater_v4f64_v4f64(double4 x, double4 y);
3769-
__bool8 __builtin_spirv_OpLessOrGreater_v8f64_v8f64(double8 x, double8 y);
3770-
__bool16 __builtin_spirv_OpLessOrGreater_v16f64_v16f64(double16 x, double16 y);
3771-
#endif // defined(cl_khr_fp64)
3772-
3773-
bool __builtin_spirv_OpOrdered_f16_f16(half x, half y);
3774-
bool __builtin_spirv_OpOrdered_f32_f32(float x, float y);
3775-
__bool2 __builtin_spirv_OpOrdered_v2f16_v2f16(half2 x, half2 y);
3776-
__bool2 __builtin_spirv_OpOrdered_v2f32_v2f32(float2 x, float2 y);
3777-
__bool3 __builtin_spirv_OpOrdered_v3f16_v3f16(half3 x, half3 y);
3778-
__bool3 __builtin_spirv_OpOrdered_v3f32_v3f32(float3 x, float3 y);
3779-
__bool4 __builtin_spirv_OpOrdered_v4f16_v4f16(half4 x, half4 y);
3780-
__bool4 __builtin_spirv_OpOrdered_v4f32_v4f32(float4 x, float4 y);
3781-
__bool8 __builtin_spirv_OpOrdered_v8f16_v8f16(half8 x, half8 y);
3782-
__bool8 __builtin_spirv_OpOrdered_v8f32_v8f32(float8 x, float8 y);
3783-
__bool16 __builtin_spirv_OpOrdered_v16f16_v16f16(half16 x, half16 y);
3784-
__bool16 __builtin_spirv_OpOrdered_v16f32_v16f32(float16 x, float16 y);
3785-
#if defined(cl_khr_fp64)
3786-
bool __builtin_spirv_OpOrdered_f64_f64(double x, double y);
3787-
__bool2 __builtin_spirv_OpOrdered_v2f64_v2f64(double2 x, double2 y);
3788-
__bool3 __builtin_spirv_OpOrdered_v3f64_v3f64(double3 x, double3 y);
3789-
__bool4 __builtin_spirv_OpOrdered_v4f64_v4f64(double4 x, double4 y);
3790-
__bool8 __builtin_spirv_OpOrdered_v8f64_v8f64(double8 x, double8 y);
3791-
__bool16 __builtin_spirv_OpOrdered_v16f64_v16f64(double16 x, double16 y);
3792-
#endif // defined(cl_khr_fp64)
3793-
3794-
bool __builtin_spirv_OpUnordered_f16_f16(half x, half y);
3795-
bool __builtin_spirv_OpUnordered_f32_f32(float x, float y);
3796-
__bool2 __builtin_spirv_OpUnordered_v2f16_v2f16(half2 x, half2 y);
3797-
__bool2 __builtin_spirv_OpUnordered_v2f32_v2f32(float2 x, float2 y);
3798-
__bool3 __builtin_spirv_OpUnordered_v3f16_v3f16(half3 x, half3 y);
3799-
__bool3 __builtin_spirv_OpUnordered_v3f32_v3f32(float3 x, float3 y);
3800-
__bool4 __builtin_spirv_OpUnordered_v4f16_v4f16(half4 x, half4 y);
3801-
__bool4 __builtin_spirv_OpUnordered_v4f32_v4f32(float4 x, float4 y);
3802-
__bool8 __builtin_spirv_OpUnordered_v8f16_v8f16(half8 x, half8 y);
3803-
__bool8 __builtin_spirv_OpUnordered_v8f32_v8f32(float8 x, float8 y);
3804-
__bool16 __builtin_spirv_OpUnordered_v16f16_v16f16(half16 x, half16 y);
3805-
__bool16 __builtin_spirv_OpUnordered_v16f32_v16f32(float16 x, float16 y);
3806-
#if defined(cl_khr_fp64)
3807-
bool __builtin_spirv_OpUnordered_f64_f64(double x, double y);
3808-
__bool2 __builtin_spirv_OpUnordered_v2f64_v2f64(double2 x, double2 y);
3809-
__bool3 __builtin_spirv_OpUnordered_v3f64_v3f64(double3 x, double3 y);
3810-
__bool4 __builtin_spirv_OpUnordered_v4f64_v4f64(double4 x, double4 y);
3811-
__bool8 __builtin_spirv_OpUnordered_v8f64_v8f64(double8 x, double8 y);
3812-
__bool16 __builtin_spirv_OpUnordered_v16f64_v16f64(double16 x, double16 y);
3752+
bool SPIRV_OVERLOADABLE SPIRV_BUILTIN(LessOrGreater, _f16_f16, )(half x, half y);
3753+
bool SPIRV_OVERLOADABLE SPIRV_BUILTIN(LessOrGreater, _f32_f32, )(float x, float y);
3754+
__bool2 SPIRV_OVERLOADABLE SPIRV_BUILTIN(LessOrGreater, _v2f16_v2f16, )(half2 x, half2 y);
3755+
__bool2 SPIRV_OVERLOADABLE SPIRV_BUILTIN(LessOrGreater, _v2f32_v2f32, )(float2 x, float2 y);
3756+
__bool3 SPIRV_OVERLOADABLE SPIRV_BUILTIN(LessOrGreater, _v3f16_v3f16, )(half3 x, half3 y);
3757+
__bool3 SPIRV_OVERLOADABLE SPIRV_BUILTIN(LessOrGreater, _v3f32_v3f32, )(float3 x, float3 y);
3758+
__bool4 SPIRV_OVERLOADABLE SPIRV_BUILTIN(LessOrGreater, _v4f16_v4f16, )(half4 x, half4 y);
3759+
__bool4 SPIRV_OVERLOADABLE SPIRV_BUILTIN(LessOrGreater, _v4f32_v4f32, )(float4 x, float4 y);
3760+
__bool8 SPIRV_OVERLOADABLE SPIRV_BUILTIN(LessOrGreater, _v8f16_v8f16, )(half8 x, half8 y);
3761+
__bool8 SPIRV_OVERLOADABLE SPIRV_BUILTIN(LessOrGreater, _v8f32_v8f32, )(float8 x, float8 y);
3762+
__bool16 SPIRV_OVERLOADABLE SPIRV_BUILTIN(LessOrGreater, _v16f16_v16f16, )(half16 x, half16 y);
3763+
__bool16 SPIRV_OVERLOADABLE SPIRV_BUILTIN(LessOrGreater, _v16f32_v16f32, )(float16 x, float16 y);
3764+
#if defined(cl_khr_fp64)
3765+
bool SPIRV_OVERLOADABLE SPIRV_BUILTIN(LessOrGreater, _f64_f64, )(double x, double y);
3766+
__bool2 SPIRV_OVERLOADABLE SPIRV_BUILTIN(LessOrGreater, _v2f64_v2f64, )(double2 x, double2 y);
3767+
__bool3 SPIRV_OVERLOADABLE SPIRV_BUILTIN(LessOrGreater, _v3f64_v3f64, )(double3 x, double3 y);
3768+
__bool4 SPIRV_OVERLOADABLE SPIRV_BUILTIN(LessOrGreater, _v4f64_v4f64, )(double4 x, double4 y);
3769+
__bool8 SPIRV_OVERLOADABLE SPIRV_BUILTIN(LessOrGreater, _v8f64_v8f64, )(double8 x, double8 y);
3770+
__bool16 SPIRV_OVERLOADABLE SPIRV_BUILTIN(LessOrGreater, _v16f64_v16f64, )(double16 x, double16 y);
3771+
#endif // defined(cl_khr_fp64)
3772+
3773+
bool SPIRV_OVERLOADABLE SPIRV_BUILTIN(Ordered, _f16_f16, )(half x, half y);
3774+
bool SPIRV_OVERLOADABLE SPIRV_BUILTIN(Ordered, _f32_f32, )(float x, float y);
3775+
__bool2 SPIRV_OVERLOADABLE SPIRV_BUILTIN(Ordered, _v2f16_v2f16, )(half2 x, half2 y);
3776+
__bool2 SPIRV_OVERLOADABLE SPIRV_BUILTIN(Ordered, _v2f32_v2f32, )(float2 x, float2 y);
3777+
__bool3 SPIRV_OVERLOADABLE SPIRV_BUILTIN(Ordered, _v3f16_v3f16, )(half3 x, half3 y);
3778+
__bool3 SPIRV_OVERLOADABLE SPIRV_BUILTIN(Ordered, _v3f32_v3f32, )(float3 x, float3 y);
3779+
__bool4 SPIRV_OVERLOADABLE SPIRV_BUILTIN(Ordered, _v4f16_v4f16, )(half4 x, half4 y);
3780+
__bool4 SPIRV_OVERLOADABLE SPIRV_BUILTIN(Ordered, _v4f32_v4f32, )(float4 x, float4 y);
3781+
__bool8 SPIRV_OVERLOADABLE SPIRV_BUILTIN(Ordered, _v8f16_v8f16, )(half8 x, half8 y);
3782+
__bool8 SPIRV_OVERLOADABLE SPIRV_BUILTIN(Ordered, _v8f32_v8f32, )(float8 x, float8 y);
3783+
__bool16 SPIRV_OVERLOADABLE SPIRV_BUILTIN(Ordered, _v16f16_v16f16, )(half16 x, half16 y);
3784+
__bool16 SPIRV_OVERLOADABLE SPIRV_BUILTIN(Ordered, _v16f32_v16f32, )(float16 x, float16 y);
3785+
#if defined(cl_khr_fp64)
3786+
bool SPIRV_OVERLOADABLE SPIRV_BUILTIN(Ordered, _f64_f64, )(double x, double y);
3787+
__bool2 SPIRV_OVERLOADABLE SPIRV_BUILTIN(Ordered, _v2f64_v2f64, )(double2 x, double2 y);
3788+
__bool3 SPIRV_OVERLOADABLE SPIRV_BUILTIN(Ordered, _v3f64_v3f64, )(double3 x, double3 y);
3789+
__bool4 SPIRV_OVERLOADABLE SPIRV_BUILTIN(Ordered, _v4f64_v4f64, )(double4 x, double4 y);
3790+
__bool8 SPIRV_OVERLOADABLE SPIRV_BUILTIN(Ordered, _v8f64_v8f64, )(double8 x, double8 y);
3791+
__bool16 SPIRV_OVERLOADABLE SPIRV_BUILTIN(Ordered, _v16f64_v16f64, )(double16 x, double16 y);
3792+
#endif // defined(cl_khr_fp64)
3793+
3794+
bool SPIRV_OVERLOADABLE SPIRV_BUILTIN(Unordered, _f16_f16, )(half x, half y);
3795+
bool SPIRV_OVERLOADABLE SPIRV_BUILTIN(Unordered, _f32_f32, )(float x, float y);
3796+
__bool2 SPIRV_OVERLOADABLE SPIRV_BUILTIN(Unordered, _v2f16_v2f16, )(half2 x, half2 y);
3797+
__bool2 SPIRV_OVERLOADABLE SPIRV_BUILTIN(Unordered, _v2f32_v2f32, )(float2 x, float2 y);
3798+
__bool3 SPIRV_OVERLOADABLE SPIRV_BUILTIN(Unordered, _v3f16_v3f16, )(half3 x, half3 y);
3799+
__bool3 SPIRV_OVERLOADABLE SPIRV_BUILTIN(Unordered, _v3f32_v3f32, )(float3 x, float3 y);
3800+
__bool4 SPIRV_OVERLOADABLE SPIRV_BUILTIN(Unordered, _v4f16_v4f16, )(half4 x, half4 y);
3801+
__bool4 SPIRV_OVERLOADABLE SPIRV_BUILTIN(Unordered, _v4f32_v4f32, )(float4 x, float4 y);
3802+
__bool8 SPIRV_OVERLOADABLE SPIRV_BUILTIN(Unordered, _v8f16_v8f16, )(half8 x, half8 y);
3803+
__bool8 SPIRV_OVERLOADABLE SPIRV_BUILTIN(Unordered, _v8f32_v8f32, )(float8 x, float8 y);
3804+
__bool16 SPIRV_OVERLOADABLE SPIRV_BUILTIN(Unordered, _v16f16_v16f16, )(half16 x, half16 y);
3805+
__bool16 SPIRV_OVERLOADABLE SPIRV_BUILTIN(Unordered, _v16f32_v16f32, )(float16 x, float16 y);
3806+
#if defined(cl_khr_fp64)
3807+
bool SPIRV_OVERLOADABLE SPIRV_BUILTIN(Unordered, _f64_f64, )(double x, double y);
3808+
__bool2 SPIRV_OVERLOADABLE SPIRV_BUILTIN(Unordered, _v2f64_v2f64, )(double2 x, double2 y);
3809+
__bool3 SPIRV_OVERLOADABLE SPIRV_BUILTIN(Unordered, _v3f64_v3f64, )(double3 x, double3 y);
3810+
__bool4 SPIRV_OVERLOADABLE SPIRV_BUILTIN(Unordered, _v4f64_v4f64, )(double4 x, double4 y);
3811+
__bool8 SPIRV_OVERLOADABLE SPIRV_BUILTIN(Unordered, _v8f64_v8f64, )(double8 x, double8 y);
3812+
__bool16 SPIRV_OVERLOADABLE SPIRV_BUILTIN(Unordered, _v16f64_v16f64, )(double16 x, double16 y);
38133813
#endif // defined(cl_khr_fp64)
38143814

38153815
// Atomic Instructions

IGC/BiFModule/Implementation/IBiF_Macros.cl

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,68 @@ IN THE SOFTWARE.
401401
#define GENERATE_VECTOR_FUNCTIONS_2ARGS( __func, __rettype, __argtype, __abbrargtype ) \
402402
GENERATE_VECTOR_FUNCTIONS_2ARGS_EXPLICIT( __func, __func, __rettype, __argtype, __abbrargtype )
403403

404+
// This is the same macro as GENERATE_VECTOR_FUNCTIONS_2ARGS_EXPLICIT, but it supports both SPV-IR
405+
// representations. Once all builtins are translated to support SPV-IR, we can remove
406+
// GENERATE_VECTOR_FUNCTIONS_2ARGS_EXPLICIT and use this once as default. For now, we need to keep both
407+
// macros.
408+
#define SPIRV_GENERATE_VECTOR_FUNCTIONS_2ARGS_EXPLICIT(__func, __sfunc, __rettype, __argtype, \
409+
__abbrargtype) \
410+
__rettype##2 SPIRV_OVERLOADABLE SPIRV_BUILTIN(__func, _v2##__abbrargtype##_v2##__abbrargtype, )( \
411+
__argtype##2 x, __argtype##2 y) { \
412+
return (__rettype##2)(SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.s0, y.s0), \
413+
SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.s1, y.s1)); \
414+
} \
415+
__rettype##3 SPIRV_OVERLOADABLE SPIRV_BUILTIN(__func, _v3##__abbrargtype##_v3##__abbrargtype, )( \
416+
__argtype##3 x, __argtype##3 y) { \
417+
return (__rettype##3)(SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.s0, y.s0), \
418+
SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.s1, y.s1), \
419+
SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.s2, y.s2)); \
420+
} \
421+
__rettype##4 SPIRV_OVERLOADABLE SPIRV_BUILTIN(__func, _v4##__abbrargtype##_v4##__abbrargtype, )( \
422+
__argtype##4 x, __argtype##4 y) { \
423+
return (__rettype##4)(SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.s0, y.s0), \
424+
SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.s1, y.s1), \
425+
SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.s2, y.s2), \
426+
SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.s3, y.s3)); \
427+
} \
428+
__rettype##8 SPIRV_OVERLOADABLE SPIRV_BUILTIN(__func, _v8##__abbrargtype##_v8##__abbrargtype, )( \
429+
__argtype##8 x, __argtype##8 y) { \
430+
return (__rettype##8)(SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.s0, y.s0), \
431+
SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.s1, y.s1), \
432+
SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.s2, y.s2), \
433+
SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.s3, y.s3), \
434+
SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.s4, y.s4), \
435+
SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.s5, y.s5), \
436+
SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.s6, y.s6), \
437+
SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.s7, y.s7)); \
438+
} \
439+
__rettype##16 SPIRV_OVERLOADABLE SPIRV_BUILTIN(__func, _v16##__abbrargtype##_v16##__abbrargtype, )( \
440+
__argtype##16 x, __argtype##16 y) { \
441+
return (__rettype##16)( \
442+
SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.s0, y.s0), \
443+
SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.s1, y.s1), \
444+
SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.s2, y.s2), \
445+
SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.s3, y.s3), \
446+
SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.s4, y.s4), \
447+
SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.s5, y.s5), \
448+
SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.s6, y.s6), \
449+
SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.s7, y.s7), \
450+
SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.s8, y.s8), \
451+
SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.s9, y.s9), \
452+
SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.sa, y.sa), \
453+
SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.sb, y.sb), \
454+
SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.sc, y.sc), \
455+
SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.sd, y.sd), \
456+
SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.se, y.se), \
457+
SPIRV_BUILTIN(__sfunc, _##__abbrargtype##_##__abbrargtype, )(x.sf, y.sf)); \
458+
}
459+
460+
// This is the same macro as GENERATE_VECTOR_FUNCTIONS_2ARGS, but it supports both SPV-IR representations.
461+
// Once all builtins are translated to support SPV-IR, we can remove GENERATE_VECTOR_FUNCTIONS_2ARGS and
462+
// use this once as default. For now, we need to keep both macros.
463+
#define SPIRV_GENERATE_VECTOR_FUNCTIONS_2ARGS(__func, __rettype, __argtype, __abbrargtype) \
464+
SPIRV_GENERATE_VECTOR_FUNCTIONS_2ARGS_EXPLICIT(__func, __func, __rettype, __argtype, __abbrargtype)
465+
404466
#define GENERATE_VECTOR_FUNCTIONS_2ARGS_VV( __func, __rettype, __argtype0, __argtype1, __abbrargtype0, __abbrargtype1 ) \
405467
__rettype##2 __func##_v2##__abbrargtype0##_v2##__abbrargtype1( __argtype0##2 x, __argtype1##2 y ) { \
406468
return (__rettype##2)( __func##_##__abbrargtype0##_##__abbrargtype1(x.s0, y.s0), \

IGC/BiFModule/Implementation/relational.cl

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -198,71 +198,71 @@ GENERATE_VECTOR_FUNCTIONS_1ARG(__builtin_spirv_OpSignBitSet, __bool, float, f32
198198
GENERATE_VECTOR_FUNCTIONS_1ARG(__builtin_spirv_OpSignBitSet, __bool, double, f64)
199199
#endif
200200

201-
bool __builtin_spirv_OpLessOrGreater_f16_f16(half x, half y)
201+
bool SPIRV_OVERLOADABLE SPIRV_BUILTIN(LessOrGreater, _f16_f16, )(half x, half y)
202202
{
203203
return (x < y) | (x > y);
204204
}
205205

206-
bool __builtin_spirv_OpLessOrGreater_f32_f32(float x, float y)
206+
bool SPIRV_OVERLOADABLE SPIRV_BUILTIN(LessOrGreater, _f32_f32, )(float x, float y)
207207
{
208208
return (x < y) | (x > y);
209209
}
210210

211211
#if defined(cl_khr_fp64)
212-
bool __builtin_spirv_OpLessOrGreater_f64_f64(double x, double y)
212+
bool SPIRV_OVERLOADABLE SPIRV_BUILTIN(LessOrGreater, _f64_f64, )(double x, double y)
213213
{
214214
return (x < y) | (x > y);
215215
}
216216
#endif
217217

218-
GENERATE_VECTOR_FUNCTIONS_2ARGS(__builtin_spirv_OpLessOrGreater, __bool, half, f16)
219-
GENERATE_VECTOR_FUNCTIONS_2ARGS(__builtin_spirv_OpLessOrGreater, __bool, float, f32)
218+
SPIRV_GENERATE_VECTOR_FUNCTIONS_2ARGS(LessOrGreater, __bool, half, f16)
219+
SPIRV_GENERATE_VECTOR_FUNCTIONS_2ARGS(LessOrGreater, __bool, float, f32)
220220
#if defined(cl_khr_fp64)
221-
GENERATE_VECTOR_FUNCTIONS_2ARGS(__builtin_spirv_OpLessOrGreater, __bool, double, f64)
221+
SPIRV_GENERATE_VECTOR_FUNCTIONS_2ARGS(LessOrGreater, __bool, double, f64)
222222
#endif
223223

224-
bool __builtin_spirv_OpOrdered_f16_f16(half x, half y)
224+
bool SPIRV_OVERLOADABLE SPIRV_BUILTIN(Ordered, _f16_f16, )(half x, half y)
225225
{
226226
return (x == x) & (y == y);
227227
}
228228

229-
bool __builtin_spirv_OpOrdered_f32_f32(float x, float y)
229+
bool SPIRV_OVERLOADABLE SPIRV_BUILTIN(Ordered, _f32_f32, )(float x, float y)
230230
{
231231
return (x == x) & (y == y);
232232
}
233233

234234
#if defined(cl_khr_fp64)
235-
bool __builtin_spirv_OpOrdered_f64_f64(double x, double y)
235+
bool SPIRV_OVERLOADABLE SPIRV_BUILTIN(Ordered, _f64_f64, )(double x, double y)
236236
{
237237
return (x == x) & (y == y);
238238
}
239239
#endif
240240

241-
GENERATE_VECTOR_FUNCTIONS_2ARGS(__builtin_spirv_OpOrdered, __bool, half, f16)
242-
GENERATE_VECTOR_FUNCTIONS_2ARGS(__builtin_spirv_OpOrdered, __bool, float, f32)
241+
SPIRV_GENERATE_VECTOR_FUNCTIONS_2ARGS(Ordered, __bool, half, f16)
242+
SPIRV_GENERATE_VECTOR_FUNCTIONS_2ARGS(Ordered, __bool, float, f32)
243243
#if defined(cl_khr_fp64)
244-
GENERATE_VECTOR_FUNCTIONS_2ARGS(__builtin_spirv_OpOrdered, __bool, double, f64)
244+
SPIRV_GENERATE_VECTOR_FUNCTIONS_2ARGS(Ordered, __bool, double, f64)
245245
#endif
246246

247-
bool __builtin_spirv_OpUnordered_f16_f16(half x, half y)
247+
bool SPIRV_OVERLOADABLE SPIRV_BUILTIN(Unordered, _f16_f16, )(half x, half y)
248248
{
249249
return (x != x) | (y != y);
250250
}
251251

252-
bool __builtin_spirv_OpUnordered_f32_f32(float x, float y)
252+
bool SPIRV_OVERLOADABLE SPIRV_BUILTIN(Unordered, _f32_f32, )(float x, float y)
253253
{
254254
return (x != x) | (y != y);
255255
}
256256

257257
#if defined(cl_khr_fp64)
258-
bool __builtin_spirv_OpUnordered_f64_f64(double x, double y)
258+
bool SPIRV_OVERLOADABLE SPIRV_BUILTIN(Unordered, _f64_f64, )(double x, double y)
259259
{
260260
return (x != x) | (y != y);
261261
}
262262
#endif
263263

264-
GENERATE_VECTOR_FUNCTIONS_2ARGS(__builtin_spirv_OpUnordered, __bool, half, f16)
265-
GENERATE_VECTOR_FUNCTIONS_2ARGS(__builtin_spirv_OpUnordered, __bool, float, f32)
264+
SPIRV_GENERATE_VECTOR_FUNCTIONS_2ARGS(Unordered, __bool, half, f16)
265+
SPIRV_GENERATE_VECTOR_FUNCTIONS_2ARGS(Unordered, __bool, float, f32)
266266
#if defined(cl_khr_fp64)
267-
GENERATE_VECTOR_FUNCTIONS_2ARGS(__builtin_spirv_OpUnordered, __bool, double, f64)
267+
SPIRV_GENERATE_VECTOR_FUNCTIONS_2ARGS(Unordered, __bool, double, f64)
268268
#endif

IGC/BiFModule/Languages/OpenCL/Relational/islessgreater.cl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ IN THE SOFTWARE.
2727

2828
INLINE int OVERLOADABLE islessgreater( float x, float y )
2929
{
30-
return __builtin_spirv_OpLessOrGreater_f32_f32( x, y );
30+
return SPIRV_BUILTIN(LessOrGreater, _f32_f32, )( x, y );
3131
}
3232

3333
static INLINE int OVERLOADABLE __intel_vector_islessgreater_helper( float x, float y )
@@ -41,7 +41,7 @@ GENERATE_VECTOR_FUNCTIONS_2ARGS_EXPLICIT( islessgreater, __intel_vector_islessgr
4141

4242
INLINE int OVERLOADABLE islessgreater( double x, double y )
4343
{
44-
return __builtin_spirv_OpLessOrGreater_f64_f64( x, y );
44+
return SPIRV_BUILTIN(LessOrGreater, _f64_f64, )( x, y );
4545
}
4646

4747
static INLINE long OVERLOADABLE __intel_vector_islessgreater_helper( double x, double y )
@@ -57,7 +57,7 @@ GENERATE_VECTOR_FUNCTIONS_2ARGS_EXPLICIT( islessgreater, __intel_vector_islessgr
5757

5858
INLINE int OVERLOADABLE islessgreater( half x, half y )
5959
{
60-
return __builtin_spirv_OpLessOrGreater_f16_f16( x, y );
60+
return SPIRV_BUILTIN(LessOrGreater, _f16_f16, )( x, y );
6161
}
6262

6363
static INLINE short OVERLOADABLE __intel_vector_islessgreater_helper( half x, half y )

0 commit comments

Comments
 (0)