Anastasia created this revision. Anastasia added reviewers: svenvh, mantognini. Herald added subscribers: ebevhan, kristof.beyls, yaxunl. Anastasia requested review of this revision.
This removed the pointless need for extension pragma since it doesn't disable anything properly and it doesn't need to enable anything that is not possible to disable. The change doesn't break existing kernels since it allows to compile more cases i.e. without pragma statements but the pragma continues to be accepted. https://reviews.llvm.org/D100985 Files: clang/lib/Headers/opencl-c.h clang/test/CodeGenOpenCL/arm-integer-dot-product.cl clang/test/SemaOpenCL/arm-integer-dot-product.cl
Index: clang/test/SemaOpenCL/arm-integer-dot-product.cl =================================================================== --- clang/test/SemaOpenCL/arm-integer-dot-product.cl +++ clang/test/SemaOpenCL/arm-integer-dot-product.cl @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -triple spir-unknown-unknown -finclude-default-header -verify -cl-std=CL1.2 -emit-llvm -o - -O0 +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -finclude-default-header -verify -cl-std=CL1.2 -emit-llvm -o - -cl-ext=-all void test_negative() { uchar4 ua8, ub8; @@ -7,37 +7,13 @@ short2 sa16, sb16; uint ur; int sr; - ur = arm_dot(ua8, ub8); // expected-error{{no matching function for call to 'arm_dot'}} - // expected-note@opencl-c.h:* {{candidate function not viable}} - // expected-note@opencl-c.h:* {{candidate unavailable as it requires OpenCL extension 'cl_arm_integer_dot_product_int8' to be enabled}} - sr = arm_dot(sa8, sb8); // expected-error{{no matching function for call to 'arm_dot'}} - // expected-note@opencl-c.h:* {{candidate function not viable}} - // expected-note@opencl-c.h:* {{candidate unavailable as it requires OpenCL extension 'cl_arm_integer_dot_product_int8' to be enabled}} - ur = arm_dot_acc(ua8, ub8, ur); // expected-error{{no matching function for call to 'arm_dot_acc'}} - // expected-note@opencl-c.h:* {{candidate function not viable}} - // expected-note@opencl-c.h:* {{candidate function not viable}} - // expected-note@opencl-c.h:* {{candidate function not viable}} - // expected-note@opencl-c.h:* {{candidate unavailable as it requires OpenCL extension 'cl_arm_integer_dot_product_accumulate_int8' to be enabled}} - sr = arm_dot_acc(sa8, sb8, sr); // expected-error{{no matching function for call to 'arm_dot_acc'}} - // expected-note@opencl-c.h:* {{candidate function not viable}} - // expected-note@opencl-c.h:* {{candidate function not viable}} - // expected-note@opencl-c.h:* {{candidate function not viable}} - // expected-note@opencl-c.h:* {{candidate unavailable as it requires OpenCL extension 'cl_arm_integer_dot_product_accumulate_int8' to be enabled}} - ur = arm_dot_acc(ua16, ub16, ur); // expected-error{{no matching function for call to 'arm_dot_acc'}} - // expected-note@opencl-c.h:* {{candidate function not viable}} - // expected-note@opencl-c.h:* {{candidate function not viable}} - // expected-note@opencl-c.h:* {{candidate function not viable}} - // expected-note@opencl-c.h:* {{candidate unavailable as it requires OpenCL extension 'cl_arm_integer_dot_product_accumulate_int16' to be enabled}} - sr = arm_dot_acc(sa16, sb16, sr); // expected-error{{no matching function for call to 'arm_dot_acc'}} - // expected-note@opencl-c.h:* {{candidate function not viable}} - // expected-note@opencl-c.h:* {{candidate function not viable}} - // expected-note@opencl-c.h:* {{candidate function not viable}} - // expected-note@opencl-c.h:* {{candidate unavailable as it requires OpenCL extension 'cl_arm_integer_dot_product_accumulate_int16' to be enabled}} - ur = arm_dot_acc_sat(ua8, ub8, ur); // expected-error{{no matching function for call to 'arm_dot_acc_sat'}} - // expected-note@opencl-c.h:* {{candidate function not viable}} - // expected-note@opencl-c.h:* {{candidate unavailable as it requires OpenCL extension 'cl_arm_integer_dot_product_accumulate_saturate_int8' to be enabled}} - sr = arm_dot_acc_sat(sa8, sb8, sr); // expected-error{{no matching function for call to 'arm_dot_acc_sat'}} - // expected-note@opencl-c.h:* {{candidate function not viable}} - // expected-note@opencl-c.h:* {{candidate unavailable as it requires OpenCL extension 'cl_arm_integer_dot_product_accumulate_saturate_int8' to be enabled}} + ur = arm_dot(ua8, ub8); // expected-error{{implicit declaration of function 'arm_dot' is invalid in OpenCL}} + sr = arm_dot(sa8, sb8); + ur = arm_dot_acc(ua8, ub8, ur); // expected-error{{implicit declaration of function 'arm_dot_acc' is invalid in OpenCL}} //expected-note{{'arm_dot_acc' declared here}} + sr = arm_dot_acc(sa8, sb8, sr); + ur = arm_dot_acc(ua16, ub16, ur); + sr = arm_dot_acc(sa16, sb16, sr); + ur = arm_dot_acc_sat(ua8, ub8, ur); // expected-error{{implicit declaration of function 'arm_dot_acc_sat' is invalid in OpenCL}} //expected-note{{did you mean 'arm_dot_acc'?}} + sr = arm_dot_acc_sat(sa8, sb8, sr); } Index: clang/test/CodeGenOpenCL/arm-integer-dot-product.cl =================================================================== --- clang/test/CodeGenOpenCL/arm-integer-dot-product.cl +++ clang/test/CodeGenOpenCL/arm-integer-dot-product.cl @@ -1,38 +1,39 @@ // RUN: %clang_cc1 %s -triple spir-unknown-unknown -finclude-default-header -fdeclare-opencl-builtins -cl-std=CL1.2 -emit-llvm -o - -O0 | FileCheck %s +// Pragmas are only accepted for backward compatibility. + #pragma OPENCL EXTENSION cl_arm_integer_dot_product_int8 : enable +#pragma OPENCL EXTENSION cl_arm_integer_dot_product_int8 : disable void test_int8(uchar4 ua, uchar4 ub, char4 sa, char4 sb) { uint ur = arm_dot(ua, ub); // CHECK: call spir_func i32 @_Z7arm_dotDv4_hS_ int sr = arm_dot(sa, sb); // CHECK: call spir_func i32 @_Z7arm_dotDv4_cS_ } -#pragma OPENCL EXTENSION cl_arm_integer_dot_product_int8 : disable #pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_int8 : enable +#pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_int8 : disable void test_accumulate_int8(uchar4 ua, uchar4 ub, uint uc, char4 sa, char4 sb, int c) { uint ur = arm_dot_acc(ua, ub, uc); // CHECK: call spir_func i32 @_Z11arm_dot_accDv4_hS_j int sr = arm_dot_acc(sa, sb, c); // CHECK: call spir_func i32 @_Z11arm_dot_accDv4_cS_i } -#pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_int8 : disable #pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_int16 : enable +#pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_int16 : disable void test_accumulate_int16(ushort2 ua, ushort2 ub, uint uc, short2 sa, short2 sb, int c) { uint ur = arm_dot_acc(ua, ub, uc); // CHECK: call spir_func i32 @_Z11arm_dot_accDv2_tS_j int sr = arm_dot_acc(sa, sb, c); // CHECK: call spir_func i32 @_Z11arm_dot_accDv2_sS_i } -#pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_int16 : disable #pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_saturate_int8 : enable +#pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_saturate_int8 : disable void test_accumulate_saturate_int8(uchar4 ua, uchar4 ub, uint uc, char4 sa, char4 sb, int c) { uint ur = arm_dot_acc_sat(ua, ub, uc); // CHECK: call spir_func i32 @_Z15arm_dot_acc_satDv4_hS_j int sr = arm_dot_acc_sat(sa, sb, c); // CHECK: call spir_func i32 @_Z15arm_dot_acc_satDv4_cS_i } -#pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_saturate_int8 : disable - Index: clang/lib/Headers/opencl-c.h =================================================================== --- clang/lib/Headers/opencl-c.h +++ clang/lib/Headers/opencl-c.h @@ -16995,31 +16995,23 @@ #endif // cl_amd_media_ops2 #if defined(cl_arm_integer_dot_product_int8) -#pragma OPENCL EXTENSION cl_arm_integer_dot_product_int8 : begin uint __ovld arm_dot(uchar4 a, uchar4 b); int __ovld arm_dot(char4 a, char4 b); -#pragma OPENCL EXTENSION cl_arm_integer_dot_product_int8 : end #endif // defined(cl_arm_integer_dot_product_int8) #if defined(cl_arm_integer_dot_product_accumulate_int8) -#pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_int8 : begin uint __ovld arm_dot_acc(uchar4 a, uchar4 b, uint c); int __ovld arm_dot_acc(char4 a, char4 b, int c); -#pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_int8 : end #endif // defined(cl_arm_integer_dot_product_accumulate_int8) #if defined(cl_arm_integer_dot_product_accumulate_int16) -#pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_int16 : begin uint __ovld arm_dot_acc(ushort2 a, ushort2 b, uint c); int __ovld arm_dot_acc(short2 a, short2 b, int c); -#pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_int16 : end #endif // defined(cl_arm_integer_dot_product_accumulate_int16) #if defined(cl_arm_integer_dot_product_accumulate_saturate_int8) -#pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_saturate_int8 : begin uint __ovld arm_dot_acc_sat(uchar4 a, uchar4 b, uint c); int __ovld arm_dot_acc_sat(char4 a, char4 b, int c); -#pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_saturate_int8 : end #endif // defined(cl_arm_integer_dot_product_accumulate_saturate_int8) // Disable any extensions we may have enabled previously.
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits