Skip to content

Commit e126c44

Browse files
authored
[libspirv] Implement missing scalar __spirv_ocl_ldexp (#20528)
Fix a regression from 36578fe which deleted scalar implementation. Additional changes: * Don't scalarize __spirv_ocl_ldexp since __clc_ldexp could be vectorized. * fix build warning in clc/integer/clc_bitfield_insert.h.
1 parent 7035592 commit e126c44

File tree

5 files changed

+23
-17
lines changed

5 files changed

+23
-17
lines changed

libclc/clc/include/clc/integer/clc_bitfield_insert.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@
1515
#define __CLC_BODY <clc/integer/clc_bitfield_insert.inc>
1616
#include <clc/integer/gentype.inc>
1717

18+
#undef __CLC_FUNCTION
19+
1820
#endif // __CLC_INTEGER_CLC_BITFIELD_INSERT_H__
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef __CLC_IMPL_FUNCTION
10+
#define __CLC_IMPL_FUNCTION(x) __CLC_CONCAT(__clc_, x)
11+
#endif
12+
13+
_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_FUNCTION(__CLC_GENTYPE x,
14+
__CLC_UINTN y) {
15+
return __CLC_IMPL_FUNCTION(__CLC_FUNCTION)(x, __CLC_AS_INTN(y));
16+
}

libclc/libspirv/lib/generic/math/ldexp.cl

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,15 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include <libspirv/spirv.h>
10-
11-
#include <clc/math/clc_subnormal_config.h>
12-
#include <clc/math/math.h>
9+
#include <clc/clc_as_type.h>
1310
#include <clc/math/clc_ldexp.h>
11+
#include <libspirv/spirv.h>
1412

1513
#define __CLC_FUNCTION __spirv_ocl_ldexp
16-
#define __CLC_IMPL_FUNCTION __clc_ldexp
14+
#define __CLC_IMPL_FUNCTION(x) __clc_ldexp
1715

18-
#define __CLC_ARG2_TYPE int
19-
#define __CLC_BODY <clc/shared/binary_def_scalarize.inc>
16+
#define __CLC_BODY <clc/shared/binary_def_with_int_second_arg.inc>
2017
#include <clc/math/gentype.inc>
21-
#undef __CLC_ARG2_TYPE
2218

23-
#define __CLC_ARG2_TYPE uint
24-
#define __CLC_BODY <clc/shared/binary_def_scalarize.inc>
19+
#define __CLC_BODY <binary_def_with_uint_second_arg.inc>
2520
#include <clc/math/gentype.inc>
26-
#undef __CLC_ARG2_TYPE

sycl/test-e2e/Complex/sycl_complex_operator_test.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
// RUN: %{build} -Wno-error=deprecated-declarations -fsycl-device-code-split=per_kernel -o %t.out
22
// RUN: %{run} %t.out
3-
//
4-
// XFAIL: target-native_cpu
5-
// XFAIL-TRACKER: https://github.com/intel/llvm/issues/20142
63

74
#include "sycl_complex_helper.hpp"
85
#include "sycl_complex_operator_test_cases.hpp"

sycl/test-e2e/syclcompat/math/math_complex.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
// RUN: %{build} -o %t.out
3434
// RUN: %{run} %t.out
3535

36-
// XFAIL: target-native_cpu
37-
// XFAIL-TRACKER: https://github.com/intel/llvm/issues/20142
38-
3936
#include <complex>
4037
#include <iostream>
4138

0 commit comments

Comments
 (0)