[llvm] r185638 - [PowerPC] Add all trap mnemonics

Ulrich Weigand ulrich.weigand at de.ibm.com
Thu Jul 4 07:40:13 PDT 2013


Author: uweigand
Date: Thu Jul  4 09:40:12 2013
New Revision: 185638

URL: http://llvm.org/viewvc/llvm-project?rev=185638&view=rev
Log:

[PowerPC] Add all trap mnemonics

This adds support for all basic and extended variants
of the trap instructions to the asm parser.


Modified:
    llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td
    llvm/trunk/test/MC/PowerPC/ppc64-encoding-ext.s
    llvm/trunk/test/MC/PowerPC/ppc64-encoding.s

Modified: llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td?rev=185638&r1=185637&r2=185638&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td Thu Jul  4 09:40:12 2013
@@ -1238,6 +1238,15 @@ def STWCX : XForm_1<31, 150, (outs), (in
 let isTerminator = 1, isBarrier = 1, hasCtrlDep = 1 in
 def TRAP  : XForm_24<31, 4, (outs), (ins), "trap", LdStLoad, [(trap)]>;
 
+def TWI : DForm_base<3, (outs), (ins u5imm:$to, gprc:$rA, s16imm:$imm),
+                     "twi $to, $rA, $imm", IntTrapW, []>;
+def TW : XForm_1<31, 4, (outs), (ins u5imm:$to, gprc:$rA, gprc:$rB),
+                 "tw $to, $rA, $rB", IntTrapW, []>;
+def TDI : DForm_base<2, (outs), (ins u5imm:$to, g8rc:$rA, s16imm:$imm),
+                     "tdi $to, $rA, $imm", IntTrapD, []>;
+def TD : XForm_1<31, 68, (outs), (ins u5imm:$to, g8rc:$rA, g8rc:$rB),
+                 "td $to, $rA, $rB", IntTrapD, []>;
+
 //===----------------------------------------------------------------------===//
 // PPC32 Load Instructions.
 //
@@ -2569,3 +2578,25 @@ def : InstAlias<"cmpd $rA, $rB", (CMPD C
 def : InstAlias<"cmpldi $rA, $imm", (CMPLDI CR0, g8rc:$rA, u16imm:$imm)>;
 def : InstAlias<"cmpld $rA, $rB", (CMPLD CR0, g8rc:$rA, g8rc:$rB)>;
 
+multiclass TrapExtendedMnemonic<string name, int to> {
+  def : InstAlias<"td"#name#"i $rA, $imm", (TDI to, g8rc:$rA, s16imm:$imm)>;
+  def : InstAlias<"td"#name#" $rA, $rB", (TD to, g8rc:$rA, g8rc:$rB)>;
+  def : InstAlias<"tw"#name#"i $rA, $imm", (TWI to, gprc:$rA, s16imm:$imm)>;
+  def : InstAlias<"tw"#name#" $rA, $rB", (TW to, gprc:$rA, gprc:$rB)>;
+}
+defm : TrapExtendedMnemonic<"lt", 16>;
+defm : TrapExtendedMnemonic<"le", 20>;
+defm : TrapExtendedMnemonic<"eq", 4>;
+defm : TrapExtendedMnemonic<"ge", 12>;
+defm : TrapExtendedMnemonic<"gt", 8>;
+defm : TrapExtendedMnemonic<"nl", 12>;
+defm : TrapExtendedMnemonic<"ne", 24>;
+defm : TrapExtendedMnemonic<"ng", 20>;
+defm : TrapExtendedMnemonic<"llt", 2>;
+defm : TrapExtendedMnemonic<"lle", 6>;
+defm : TrapExtendedMnemonic<"lge", 5>;
+defm : TrapExtendedMnemonic<"lgt", 1>;
+defm : TrapExtendedMnemonic<"lnl", 5>;
+defm : TrapExtendedMnemonic<"lng", 6>;
+defm : TrapExtendedMnemonic<"u", 31>;
+

Modified: llvm/trunk/test/MC/PowerPC/ppc64-encoding-ext.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/PowerPC/ppc64-encoding-ext.s?rev=185638&r1=185637&r2=185638&view=diff
==============================================================================
--- llvm/trunk/test/MC/PowerPC/ppc64-encoding-ext.s (original)
+++ llvm/trunk/test/MC/PowerPC/ppc64-encoding-ext.s Thu Jul  4 09:40:12 2013
@@ -1951,7 +1951,145 @@
 # CHECK: cmplw 0, 3, 4                   # encoding: [0x7c,0x03,0x20,0x40]
          cmplw 3, 4
 
-# FIXME: Trap mnemonics
+# Trap mnemonics
+
+# CHECK: twi 16, 3, 4                    # encoding: [0x0e,0x03,0x00,0x04]
+         twlti 3, 4
+# CHECK: tw 16, 3, 4                     # encoding: [0x7e,0x03,0x20,0x08]
+         twlt 3, 4
+# CHECK: tdi 16, 3, 4                    # encoding: [0x0a,0x03,0x00,0x04]
+         tdlti 3, 4
+# CHECK: td 16, 3, 4                     # encoding: [0x7e,0x03,0x20,0x88]
+         tdlt 3, 4
+
+# CHECK: twi 20, 3, 4                    # encoding: [0x0e,0x83,0x00,0x04]
+         twlei 3, 4
+# CHECK: tw 20, 3, 4                     # encoding: [0x7e,0x83,0x20,0x08]
+         twle 3, 4
+# CHECK: tdi 20, 3, 4                    # encoding: [0x0a,0x83,0x00,0x04]
+         tdlei 3, 4
+# CHECK: td 20, 3, 4                     # encoding: [0x7e,0x83,0x20,0x88]
+         tdle 3, 4
+
+# CHECK: twi 4, 3, 4                     # encoding: [0x0c,0x83,0x00,0x04]
+         tweqi 3, 4
+# CHECK: tw 4, 3, 4                      # encoding: [0x7c,0x83,0x20,0x08]
+         tweq 3, 4
+# CHECK: tdi 4, 3, 4                     # encoding: [0x08,0x83,0x00,0x04]
+         tdeqi 3, 4
+# CHECK: td 4, 3, 4                      # encoding: [0x7c,0x83,0x20,0x88]
+         tdeq 3, 4
+
+# CHECK: twi 12, 3, 4                    # encoding: [0x0d,0x83,0x00,0x04]
+         twgei 3, 4
+# CHECK: tw 12, 3, 4                     # encoding: [0x7d,0x83,0x20,0x08]
+         twge 3, 4
+# CHECK: tdi 12, 3, 4                    # encoding: [0x09,0x83,0x00,0x04]
+         tdgei 3, 4
+# CHECK: td 12, 3, 4                     # encoding: [0x7d,0x83,0x20,0x88]
+         tdge 3, 4
+
+# CHECK: twi 8, 3, 4                     # encoding: [0x0d,0x03,0x00,0x04]
+         twgti 3, 4
+# CHECK: tw 8, 3, 4                      # encoding: [0x7d,0x03,0x20,0x08]
+         twgt 3, 4
+# CHECK: tdi 8, 3, 4                     # encoding: [0x09,0x03,0x00,0x04]
+         tdgti 3, 4
+# CHECK: td 8, 3, 4                      # encoding: [0x7d,0x03,0x20,0x88]
+         tdgt 3, 4
+
+# CHECK: twi 12, 3, 4                    # encoding: [0x0d,0x83,0x00,0x04]
+         twnli 3, 4
+# CHECK: tw 12, 3, 4                     # encoding: [0x7d,0x83,0x20,0x08]
+         twnl 3, 4
+# CHECK: tdi 12, 3, 4                    # encoding: [0x09,0x83,0x00,0x04]
+         tdnli 3, 4
+# CHECK: td 12, 3, 4                     # encoding: [0x7d,0x83,0x20,0x88]
+         tdnl 3, 4
+
+# CHECK: twi 24, 3, 4                    # encoding: [0x0f,0x03,0x00,0x04]
+         twnei 3, 4
+# CHECK: tw 24, 3, 4                     # encoding: [0x7f,0x03,0x20,0x08]
+         twne 3, 4
+# CHECK: tdi 24, 3, 4                    # encoding: [0x0b,0x03,0x00,0x04]
+         tdnei 3, 4
+# CHECK: td 24, 3, 4                     # encoding: [0x7f,0x03,0x20,0x88]
+         tdne 3, 4
+
+# CHECK: twi 20, 3, 4                    # encoding: [0x0e,0x83,0x00,0x04]
+         twngi 3, 4
+# CHECK: tw 20, 3, 4                     # encoding: [0x7e,0x83,0x20,0x08]
+         twng 3, 4
+# CHECK: tdi 20, 3, 4                    # encoding: [0x0a,0x83,0x00,0x04]
+         tdngi 3, 4
+# CHECK: td 20, 3, 4                     # encoding: [0x7e,0x83,0x20,0x88]
+         tdng 3, 4
+
+# CHECK: twi 2, 3, 4                     # encoding: [0x0c,0x43,0x00,0x04]
+         twllti 3, 4
+# CHECK: tw 2, 3, 4                      # encoding: [0x7c,0x43,0x20,0x08]
+         twllt 3, 4
+# CHECK: tdi 2, 3, 4                     # encoding: [0x08,0x43,0x00,0x04]
+         tdllti 3, 4
+# CHECK: td 2, 3, 4                      # encoding: [0x7c,0x43,0x20,0x88]
+         tdllt 3, 4
+
+# CHECK: twi 6, 3, 4                     # encoding: [0x0c,0xc3,0x00,0x04]
+         twllei 3, 4
+# CHECK: tw 6, 3, 4                      # encoding: [0x7c,0xc3,0x20,0x08]
+         twlle 3, 4
+# CHECK: tdi 6, 3, 4                     # encoding: [0x08,0xc3,0x00,0x04]
+         tdllei 3, 4
+# CHECK: td 6, 3, 4                      # encoding: [0x7c,0xc3,0x20,0x88]
+         tdlle 3, 4
+
+# CHECK: twi 5, 3, 4                     # encoding: [0x0c,0xa3,0x00,0x04]
+         twlgei 3, 4
+# CHECK: tw 5, 3, 4                      # encoding: [0x7c,0xa3,0x20,0x08]
+         twlge 3, 4
+# CHECK: tdi 5, 3, 4                     # encoding: [0x08,0xa3,0x00,0x04]
+         tdlgei 3, 4
+# CHECK: td 5, 3, 4                      # encoding: [0x7c,0xa3,0x20,0x88]
+         tdlge 3, 4
+
+# CHECK: twi 1, 3, 4                     # encoding: [0x0c,0x23,0x00,0x04]
+         twlgti 3, 4
+# CHECK: tw 1, 3, 4                      # encoding: [0x7c,0x23,0x20,0x08]
+         twlgt 3, 4
+# CHECK: tdi 1, 3, 4                     # encoding: [0x08,0x23,0x00,0x04]
+         tdlgti 3, 4
+# CHECK: td 1, 3, 4                      # encoding: [0x7c,0x23,0x20,0x88]
+         tdlgt 3, 4
+
+# CHECK: twi 5, 3, 4                     # encoding: [0x0c,0xa3,0x00,0x04]
+         twlnli 3, 4
+# CHECK: tw 5, 3, 4                      # encoding: [0x7c,0xa3,0x20,0x08]
+         twlnl 3, 4
+# CHECK: tdi 5, 3, 4                     # encoding: [0x08,0xa3,0x00,0x04]
+         tdlnli 3, 4
+# CHECK: td 5, 3, 4                      # encoding: [0x7c,0xa3,0x20,0x88]
+         tdlnl 3, 4
+
+# CHECK: twi 6, 3, 4                     # encoding: [0x0c,0xc3,0x00,0x04]
+         twlngi 3, 4
+# CHECK: tw 6, 3, 4                      # encoding: [0x7c,0xc3,0x20,0x08]
+         twlng 3, 4
+# CHECK: tdi 6, 3, 4                     # encoding: [0x08,0xc3,0x00,0x04]
+         tdlngi 3, 4
+# CHECK: td 6, 3, 4                      # encoding: [0x7c,0xc3,0x20,0x88]
+         tdlng 3, 4
+
+# CHECK: twi 31, 3, 4                    # encoding: [0x0f,0xe3,0x00,0x04]
+         twui 3, 4
+# CHECK: tw 31, 3, 4                     # encoding: [0x7f,0xe3,0x20,0x08]
+         twu 3, 4
+# CHECK: tdi 31, 3, 4                    # encoding: [0x0b,0xe3,0x00,0x04]
+         tdui 3, 4
+# CHECK: td 31, 3, 4                     # encoding: [0x7f,0xe3,0x20,0x88]
+         tdu 3, 4
+
+# CHECK: trap                            # encoding: [0x7f,0xe0,0x00,0x08]
+         trap
 
 # Rotate and shift mnemonics
 

Modified: llvm/trunk/test/MC/PowerPC/ppc64-encoding.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/PowerPC/ppc64-encoding.s?rev=185638&r1=185637&r2=185638&view=diff
==============================================================================
--- llvm/trunk/test/MC/PowerPC/ppc64-encoding.s (original)
+++ llvm/trunk/test/MC/PowerPC/ppc64-encoding.s Thu Jul  4 09:40:12 2013
@@ -346,7 +346,16 @@
 
 # FIXME: Fixed-point compare instructions
 
-# FIXME: Fixed-point trap instructions
+# Fixed-point trap instructions
+
+# CHECK: twi 2, 3, 4                     # encoding: [0x0c,0x43,0x00,0x04]
+         twi 2, 3, 4
+# CHECK: tw 2, 3, 4                      # encoding: [0x7c,0x43,0x20,0x08]
+         tw 2, 3, 4
+# CHECK: tdi 2, 3, 4                     # encoding: [0x08,0x43,0x00,0x04]
+         tdi 2, 3, 4
+# CHECK: td 2, 3, 4                      # encoding: [0x7c,0x43,0x20,0x88]
+         td 2, 3, 4
 
 # Fixed-point select
 





More information about the llvm-commits mailing list