Quote Originally Posted by Drago View Post
Changing this:
bld_base->op_actions[TGSI_OPCODE_KIL].intr_name = "llvm.AMDGPU.kill";
into this:
bld_base->op_actions[TGSI_OPCODE_KIL].intr_name = "llvm.AMDGPU.kilp";
Game is playable, but with model artifacts. I believe they are not related to this change.
From this definition in R600Instructions.td, I conclude that above patching is legit:
def KILP : Pat <
  (MASK_WRITE (KILLGT (f32 ONE), (f32 ZERO)))
Probably the same as KILL, but with small overhead.
KILP and KIL are different instructions. KILP unconditionally kills a pixel, while KIL conditionally kills the pixel based on the value of src0. The intrinsic llvm.AMDGPU.kill is correct for TGSI_OPCODE_KIL. The reason you are seeing the "cannot select" error is because there is no pattern like the one above for int_AMDGPU_kill.

In order to figure out what pattern to use, you need to look at the definition of KIL in the tgsi docs (src/gallium/docs/source/tgsi.rst) and then look in the ISA doc (there is a list of ISA docs here: http://www.x.org/wiki/RadeonFeature) for your card to find the r600 hardware instruction that KIL should be lowered to.