-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for 'fneg' when translate from LLVM to SPIR-V
It adds support for the fneg operation (added in LLVM 8.0.0) when translating from LLVM IR to SPIR-V, using the SPIR-V FNegate operation. Signed-off-by: Ilya Mashkov ilya.mashkov@intel.com Fix #359
- Loading branch information
1 parent
5de3935
commit 128e4c5
Showing
3 changed files
with
27 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// RUN: %clang_cc1 -triple spir-unknown-unknown -O0 -cl-std=CL2.0 -finclude-default-header -emit-llvm-bc %s -o %t.bc | ||
// RUN: llvm-spirv %t.bc -spirv-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV | ||
// RUN: llvm-spirv %t.bc -o %t.spv | ||
// RUN: spirv-val %t.spv | ||
// RUN: llvm-spirv -r %t.spv -o %t.rev.bc | ||
// RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM | ||
|
||
// CHECK-SPIRV: FNegate | ||
// CHECK-SPIRV: FNegate | ||
// CHECK-SPIRV: FNegate | ||
// CHECK-SPIRV: FNegate | ||
|
||
// CHECK-LLVM: fsub half 0xH8000, % | ||
// CHECK-LLVM: fsub float -0.000000e+00, % | ||
// CHECK-LLVM: fsub double -0.000000e+00, % | ||
// CHECK-LLVM: fsub <8 x double> <double -0.000000e+00, double -0.000000e+00, double -0.000000e+00, double -0.000000e+00, double -0.000000e+00, double -0.000000e+00, double -0.000000e+00, double -0.000000e+00>, % | ||
|
||
#pragma OPENCL EXTENSION cl_khr_fp64 : enable | ||
#pragma OPENCL EXTENSION cl_khr_fp16 : enable | ||
|
||
__kernel void foo(double a1, __global half *h, __global float *b0, __global double *b1, __global double8 *d) { | ||
*h = -*h; | ||
*b0 = -*b0; | ||
*b1 = -a1; | ||
*d = -*d; | ||
} |