[LLVMdev] [LLVMDev] Add not instruction to PTX backend

陳韋任
Wed, 11 May 2011 09:04:01 -0000

Hi, Dan

  I add "not" instruction support in PTXInstrInfo.td as
you suggested before.

multiclass PTX_LOGIC_2OP<string opcstr,PatFrag opnode> {
  ...
}

  Now I am trying to write test case for logic and shift
operations. But I have a trouble in mapping LLVM IR to PTX
IR for "not" instruction. The test case I wrote is,

define ptx_device i16 @t4_u16(i16 %x) {
; CHECK: not.b16 rh0, rh1, rh2;
; CHECK-NEXT: ret;
  %z = xor i16 %x, 1
  ret i16 %z
}

Since LLVM IR doesn't support logical not directly, I use "xor i16 %x,
1"
to represent logical not in LLVM IR. It turns out the IR is mapped to
PTX "xor" not PTX "not". Any idea on how to get the mapping
correct?

  Thanks.

Regards,
chenwj

--
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667