mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-03 15:50:17 +01:00
radeon/llvm: add support for cos/sin intrinsic
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
This commit is contained in:
parent
876b42663c
commit
23e11ac835
3 changed files with 15 additions and 12 deletions
|
|
@ -21,7 +21,6 @@ let TargetPrefix = "AMDGPU", isTarget = 1 in {
|
|||
|
||||
def int_AMDGPU_arl : Intrinsic<[llvm_i32_ty], [llvm_float_ty], [IntrNoMem]>;
|
||||
def int_AMDGPU_cndlt : Intrinsic<[llvm_float_ty], [llvm_float_ty, llvm_float_ty, llvm_float_ty], [IntrNoMem]>;
|
||||
def int_AMDGPU_cos : Intrinsic<[llvm_float_ty], [llvm_float_ty], [IntrNoMem]>;
|
||||
def int_AMDGPU_div : Intrinsic<[llvm_float_ty], [llvm_float_ty, llvm_float_ty], [IntrNoMem]>;
|
||||
def int_AMDGPU_dp4 : Intrinsic<[llvm_float_ty], [llvm_v4f32_ty, llvm_v4f32_ty], [IntrNoMem]>;
|
||||
def int_AMDGPU_floor : Intrinsic<[llvm_float_ty], [llvm_float_ty], [IntrNoMem]>;
|
||||
|
|
@ -35,7 +34,6 @@ let TargetPrefix = "AMDGPU", isTarget = 1 in {
|
|||
def int_AMDGPU_seq : Intrinsic<[llvm_float_ty], [llvm_float_ty, llvm_float_ty], [IntrNoMem]>;
|
||||
def int_AMDGPU_sgt : Intrinsic<[llvm_float_ty], [llvm_float_ty, llvm_float_ty], [IntrNoMem]>;
|
||||
def int_AMDGPU_sge : Intrinsic<[llvm_float_ty], [llvm_float_ty, llvm_float_ty], [IntrNoMem]>;
|
||||
def int_AMDGPU_sin : Intrinsic<[llvm_float_ty], [llvm_float_ty], [IntrNoMem]>;
|
||||
def int_AMDGPU_sle : Intrinsic<[llvm_float_ty], [llvm_float_ty, llvm_float_ty], [IntrNoMem]>;
|
||||
def int_AMDGPU_sne : Intrinsic<[llvm_float_ty], [llvm_float_ty, llvm_float_ty], [IntrNoMem]>;
|
||||
def int_AMDGPU_ssg : Intrinsic<[llvm_float_ty], [llvm_float_ty], [IntrNoMem]>;
|
||||
|
|
|
|||
|
|
@ -905,8 +905,13 @@ let Predicates = [isR600] in {
|
|||
|
||||
// Helper pattern for normalizing inputs to triginomic instructions for R700+
|
||||
// cards.
|
||||
class TRIG_eg <InstR600 trig, Intrinsic intr> : Pat<
|
||||
(intr R600_Reg32:$src),
|
||||
class COS_PAT <InstR600 trig> : Pat<
|
||||
(fcos R600_Reg32:$src),
|
||||
(trig (MUL (MOV_IMM_I32 (i32 ALU_LITERAL_X), CONST.TWO_PI_INV), R600_Reg32:$src))
|
||||
>;
|
||||
|
||||
class SIN_PAT <InstR600 trig> : Pat<
|
||||
(fsin R600_Reg32:$src),
|
||||
(trig (MUL (MOV_IMM_I32 (i32 ALU_LITERAL_X), CONST.TWO_PI_INV), R600_Reg32:$src))
|
||||
>;
|
||||
|
||||
|
|
@ -919,8 +924,8 @@ let Predicates = [isR700] in {
|
|||
def COS_r700 : COS_Common<0x6F>;
|
||||
|
||||
// R700 normalizes inputs to SIN/COS the same as EG
|
||||
def : TRIG_eg <SIN_r700, int_AMDGPU_sin>;
|
||||
def : TRIG_eg <COS_r700, int_AMDGPU_cos>;
|
||||
def : SIN_PAT <SIN_r700>;
|
||||
def : COS_PAT <COS_r700>;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
@ -997,8 +1002,8 @@ let Predicates = [isEGorCayman] in {
|
|||
def SSG_eg : SSG_Common<CNDGT_eg, CNDGE_eg>;
|
||||
def TGSI_LIT_Z_eg : TGSI_LIT_Z_Common<MUL_LIT_eg, LOG_CLAMPED_eg, EXP_IEEE_eg>;
|
||||
|
||||
def : TRIG_eg <SIN_eg, int_AMDGPU_sin>;
|
||||
def : TRIG_eg <COS_eg, int_AMDGPU_cos>;
|
||||
def : SIN_PAT <SIN_eg>;
|
||||
def : COS_PAT <COS_eg>;
|
||||
|
||||
def FLT_TO_INT_eg : FLT_TO_INT_Common<0x50> {
|
||||
let Pattern = [];
|
||||
|
|
|
|||
|
|
@ -1133,8 +1133,8 @@ void radeon_llvm_context_init(struct radeon_llvm_context * ctx)
|
|||
bld_base->op_actions[TGSI_OPCODE_CLAMP].intr_name = "llvm.AMDIL.clamp.";
|
||||
bld_base->op_actions[TGSI_OPCODE_CMP].emit = build_tgsi_intrinsic_nomem;
|
||||
bld_base->op_actions[TGSI_OPCODE_CMP].intr_name = "llvm.AMDGPU.cndlt";
|
||||
bld_base->op_actions[TGSI_OPCODE_COS].emit = build_tgsi_intrinsic_nomem;
|
||||
bld_base->op_actions[TGSI_OPCODE_COS].intr_name = "llvm.AMDGPU.cos";
|
||||
bld_base->op_actions[TGSI_OPCODE_COS].emit = build_tgsi_intrinsic_readonly;
|
||||
bld_base->op_actions[TGSI_OPCODE_COS].intr_name = "llvm.cos.f32";
|
||||
bld_base->op_actions[TGSI_OPCODE_DIV].emit = build_tgsi_intrinsic_nomem;
|
||||
bld_base->op_actions[TGSI_OPCODE_DIV].intr_name = "llvm.AMDGPU.div";
|
||||
bld_base->op_actions[TGSI_OPCODE_ELSE].emit = else_emit;
|
||||
|
|
@ -1175,8 +1175,8 @@ void radeon_llvm_context_init(struct radeon_llvm_context * ctx)
|
|||
bld_base->op_actions[TGSI_OPCODE_SLT].emit = emit_cmp;
|
||||
bld_base->op_actions[TGSI_OPCODE_SNE].emit = emit_cmp;
|
||||
bld_base->op_actions[TGSI_OPCODE_SGT].emit = emit_cmp;
|
||||
bld_base->op_actions[TGSI_OPCODE_SIN].emit = build_tgsi_intrinsic_nomem;
|
||||
bld_base->op_actions[TGSI_OPCODE_SIN].intr_name = "llvm.AMDGPU.sin";
|
||||
bld_base->op_actions[TGSI_OPCODE_SIN].emit = build_tgsi_intrinsic_readonly;
|
||||
bld_base->op_actions[TGSI_OPCODE_SIN].intr_name = "llvm.sin.f32";
|
||||
bld_base->op_actions[TGSI_OPCODE_TEX].fetch_args = tex_fetch_args;
|
||||
bld_base->op_actions[TGSI_OPCODE_TEX].intr_name = "llvm.AMDGPU.tex";
|
||||
bld_base->op_actions[TGSI_OPCODE_TXB].fetch_args = tex_fetch_args;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue