diff options
author | Karol Herbst <[email protected]> | 2018-07-12 15:02:27 +0200 |
---|---|---|
committer | Karol Herbst <[email protected]> | 2019-03-05 22:28:29 +0100 |
commit | 272e927d0e9fed6e791d706ff5d895b6c2036fc0 (patch) | |
tree | 2bbe3b7fbef9275137bd4669cb86b72181094379 /src/compiler/spirv/vtn_alu.c | |
parent | d0b47ec4df0eafe4f4afddc2a0594b392c27f426 (diff) |
nir/spirv: initial handling of OpenCL.std extension opcodes
Not complete, mostly just adding things as I encounter them in CTS. But
not getting far enough yet to hit most of the OpenCL.std instructions.
Anyway, this is better than nothing and covers the most common builtins.
v2: add hadd proof from Jason
move some of the lowering into opt_algebraic and create new nir opcodes
simplify nextafter lowering
fix normalize lowering for inf
rework upsample to use nir_pack_bits
add missing files to build systems
v3: split lines of iadd/sub_sat expressions
Signed-off-by: Karol Herbst <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler/spirv/vtn_alu.c')
-rw-r--r-- | src/compiler/spirv/vtn_alu.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/compiler/spirv/vtn_alu.c b/src/compiler/spirv/vtn_alu.c index fa8f259a006..6bc015a096d 100644 --- a/src/compiler/spirv/vtn_alu.c +++ b/src/compiler/spirv/vtn_alu.c @@ -636,6 +636,21 @@ vtn_handle_alu(struct vtn_builder *b, SpvOp opcode, break; } + case SpvOpSignBitSet: { + unsigned src_bit_size = glsl_get_bit_size(vtn_src[0]->type); + if (src[0]->num_components == 1) + val->ssa->def = + nir_ushr(&b->nb, src[0], nir_imm_int(&b->nb, src_bit_size - 1)); + else + val->ssa->def = + nir_ishr(&b->nb, src[0], nir_imm_int(&b->nb, src_bit_size - 1)); + + if (src_bit_size != 32) + val->ssa->def = nir_u2u32(&b->nb, val->ssa->def); + + break; + } + default: { bool swap; unsigned src_bit_size = glsl_get_bit_size(vtn_src[0]->type); |