2006-06-16 20:22:01 +00:00
|
|
|
//===- PPCInstr64Bit.td - The PowerPC 64-bit Support -------*- tablegen -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file was developed by Chris Lattner and is distributed under
|
|
|
|
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file describes the PowerPC 64-bit instructions. These patterns are used
|
|
|
|
// both when in ppc64 mode and when in "use 64-bit extensions in 32-bit" mode.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2006-06-20 21:23:06 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// 64-bit operands.
|
|
|
|
//
|
2006-06-26 23:53:10 +00:00
|
|
|
def s16imm64 : Operand<i64> {
|
|
|
|
let PrintMethod = "printS16ImmOperand";
|
|
|
|
}
|
|
|
|
def u16imm64 : Operand<i64> {
|
|
|
|
let PrintMethod = "printU16ImmOperand";
|
|
|
|
}
|
2006-06-20 21:23:06 +00:00
|
|
|
def symbolHi64 : Operand<i64> {
|
|
|
|
let PrintMethod = "printSymbolHi";
|
|
|
|
}
|
|
|
|
def symbolLo64 : Operand<i64> {
|
|
|
|
let PrintMethod = "printSymbolLo";
|
|
|
|
}
|
|
|
|
|
2006-06-20 23:18:58 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// 64-bit transformation functions.
|
|
|
|
//
|
|
|
|
|
|
|
|
def SHL64 : SDNodeXForm<imm, [{
|
|
|
|
// Transformation function: 63 - imm
|
|
|
|
return getI32Imm(63 - N->getValue());
|
|
|
|
}]>;
|
2006-06-20 21:23:06 +00:00
|
|
|
|
2006-06-20 23:18:58 +00:00
|
|
|
def SRL64 : SDNodeXForm<imm, [{
|
|
|
|
// Transformation function: 64 - imm
|
|
|
|
return N->getValue() ? getI32Imm(64 - N->getValue()) : getI32Imm(0);
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
def HI32_48 : SDNodeXForm<imm, [{
|
|
|
|
// Transformation function: shift the immediate value down into the low bits.
|
|
|
|
return getI32Imm((unsigned short)(N->getValue() >> 32));
|
|
|
|
}]>;
|
|
|
|
|
|
|
|
def HI48_64 : SDNodeXForm<imm, [{
|
|
|
|
// Transformation function: shift the immediate value down into the low bits.
|
|
|
|
return getI32Imm((unsigned short)(N->getValue() >> 48));
|
|
|
|
}]>;
|
2006-06-20 21:23:06 +00:00
|
|
|
|
2006-06-16 20:22:01 +00:00
|
|
|
|
2006-06-27 18:18:41 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Pseudo instructions.
|
|
|
|
//
|
|
|
|
|
2006-07-18 16:33:26 +00:00
|
|
|
def IMPLICIT_DEF_G8RC : Pseudo<(ops G8RC:$rD), "; IMPLICIT_DEF_G8RC $rD",
|
2006-06-27 18:18:41 +00:00
|
|
|
[(set G8RC:$rD, (undef))]>;
|
|
|
|
|
2006-11-14 18:44:47 +00:00
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Calls.
|
|
|
|
//
|
|
|
|
|
|
|
|
let Defs = [LR8] in
|
|
|
|
def MovePCtoLR8 : Pseudo<(ops piclabel:$label), "bl $label", []>,
|
|
|
|
PPC970_Unit_BRU;
|
|
|
|
|
|
|
|
let isCall = 1, noResults = 1, PPC970_Unit = 7,
|
|
|
|
// All calls clobber the PPC64 non-callee saved registers.
|
|
|
|
Defs = [X0,X2,X3,X4,X5,X6,X7,X8,X9,X10,X11,X12,
|
|
|
|
F0,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,F13,
|
|
|
|
V0,V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,V11,V12,V13,V14,V15,V16,V17,V18,V19,
|
|
|
|
LR8,CTR8,
|
|
|
|
CR0,CR1,CR5,CR6,CR7] in {
|
|
|
|
// Convenient aliases for call instructions
|
|
|
|
def BL8 : IForm<18, 0, 1, (ops calltarget:$func, variable_ops),
|
|
|
|
"bl $func", BrB, []>; // See Pat patterns below.
|
|
|
|
|
|
|
|
def BLA8 : IForm<18, 1, 1, (ops aaddr:$func, variable_ops),
|
|
|
|
"bla $func", BrB, [(PPCcall (i64 imm:$func))]>;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Calls
|
|
|
|
def : Pat<(PPCcall (i64 tglobaladdr:$dst)),
|
|
|
|
(BL8 tglobaladdr:$dst)>;
|
|
|
|
def : Pat<(PPCcall (i64 texternalsym:$dst)),
|
|
|
|
(BL8 texternalsym:$dst)>;
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// 64-bit SPR manipulation instrs.
|
|
|
|
|
|
|
|
def MFCTR8 : XFXForm_1_ext<31, 339, 9, (ops G8RC:$rT), "mfctr $rT", SprMFSPR>,
|
|
|
|
PPC970_DGroup_First, PPC970_Unit_FXU;
|
2006-06-27 18:36:44 +00:00
|
|
|
let Pattern = [(PPCmtctr G8RC:$rS)] in {
|
|
|
|
def MTCTR8 : XFXForm_7_ext<31, 467, 9, (ops G8RC:$rS), "mtctr $rS", SprMTSPR>,
|
2006-11-14 18:44:47 +00:00
|
|
|
PPC970_DGroup_First, PPC970_Unit_FXU;
|
2006-06-27 18:36:44 +00:00
|
|
|
}
|
2006-06-27 18:18:41 +00:00
|
|
|
|
2006-11-14 18:44:47 +00:00
|
|
|
def MTLR8 : XFXForm_7_ext<31, 467, 8, (ops G8RC:$rS), "mtlr $rS", SprMTSPR>,
|
|
|
|
PPC970_DGroup_First, PPC970_Unit_FXU;
|
|
|
|
def MFLR8 : XFXForm_1_ext<31, 339, 8, (ops G8RC:$rT), "mflr $rT", SprMFSPR>,
|
|
|
|
PPC970_DGroup_First, PPC970_Unit_FXU;
|
|
|
|
|
|
|
|
|
2006-06-16 20:22:01 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Fixed point instructions.
|
|
|
|
//
|
|
|
|
|
|
|
|
let PPC970_Unit = 1 in { // FXU Operations.
|
|
|
|
|
Add some 64-bit logical ops.
Split imm16Shifted into a sext/zext form for 64-bit support.
Add some patterns for immediate formation. For example, we now compile this:
static unsigned long long Y;
void test3() {
Y = 0xF0F00F00;
}
into:
_test3:
li r2, 3840
lis r3, ha16(_Y)
xoris r2, r2, 61680
std r2, lo16(_Y)(r3)
blr
GCC produces:
_test3:
li r0,0
lis r2,ha16(_Y)
ori r0,r0,61680
sldi r0,r0,16
ori r0,r0,3840
std r0,lo16(_Y)(r2)
blr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28883 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-20 22:34:10 +00:00
|
|
|
// Copies, extends, truncates.
|
2006-06-16 20:22:01 +00:00
|
|
|
def OR4To8 : XForm_6<31, 444, (ops G8RC:$rA, GPRC:$rS, GPRC:$rB),
|
|
|
|
"or $rA, $rS, $rB", IntGeneral,
|
|
|
|
[]>;
|
|
|
|
def OR8To4 : XForm_6<31, 444, (ops GPRC:$rA, G8RC:$rS, G8RC:$rB),
|
|
|
|
"or $rA, $rS, $rB", IntGeneral,
|
|
|
|
[]>;
|
Add some 64-bit logical ops.
Split imm16Shifted into a sext/zext form for 64-bit support.
Add some patterns for immediate formation. For example, we now compile this:
static unsigned long long Y;
void test3() {
Y = 0xF0F00F00;
}
into:
_test3:
li r2, 3840
lis r3, ha16(_Y)
xoris r2, r2, 61680
std r2, lo16(_Y)(r3)
blr
GCC produces:
_test3:
li r0,0
lis r2,ha16(_Y)
ori r0,r0,61680
sldi r0,r0,16
ori r0,r0,3840
std r0,lo16(_Y)(r2)
blr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28883 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-20 22:34:10 +00:00
|
|
|
|
|
|
|
def LI8 : DForm_2_r0<14, (ops G8RC:$rD, symbolLo64:$imm),
|
|
|
|
"li $rD, $imm", IntGeneral,
|
|
|
|
[(set G8RC:$rD, immSExt16:$imm)]>;
|
|
|
|
def LIS8 : DForm_2_r0<15, (ops G8RC:$rD, symbolHi64:$imm),
|
|
|
|
"lis $rD, $imm", IntGeneral,
|
|
|
|
[(set G8RC:$rD, imm16ShiftedSExt:$imm)]>;
|
|
|
|
|
|
|
|
// Logical ops.
|
2006-06-20 23:11:59 +00:00
|
|
|
def NAND8: XForm_6<31, 476, (ops G8RC:$rA, G8RC:$rS, G8RC:$rB),
|
|
|
|
"nand $rA, $rS, $rB", IntGeneral,
|
|
|
|
[(set G8RC:$rA, (not (and G8RC:$rS, G8RC:$rB)))]>;
|
|
|
|
def AND8 : XForm_6<31, 28, (ops G8RC:$rA, G8RC:$rS, G8RC:$rB),
|
|
|
|
"and $rA, $rS, $rB", IntGeneral,
|
|
|
|
[(set G8RC:$rA, (and G8RC:$rS, G8RC:$rB))]>;
|
|
|
|
def ANDC8: XForm_6<31, 60, (ops G8RC:$rA, G8RC:$rS, G8RC:$rB),
|
|
|
|
"andc $rA, $rS, $rB", IntGeneral,
|
|
|
|
[(set G8RC:$rA, (and G8RC:$rS, (not G8RC:$rB)))]>;
|
|
|
|
def OR8 : XForm_6<31, 444, (ops G8RC:$rA, G8RC:$rS, G8RC:$rB),
|
|
|
|
"or $rA, $rS, $rB", IntGeneral,
|
|
|
|
[(set G8RC:$rA, (or G8RC:$rS, G8RC:$rB))]>;
|
|
|
|
def NOR8 : XForm_6<31, 124, (ops G8RC:$rA, G8RC:$rS, G8RC:$rB),
|
|
|
|
"nor $rA, $rS, $rB", IntGeneral,
|
|
|
|
[(set G8RC:$rA, (not (or G8RC:$rS, G8RC:$rB)))]>;
|
|
|
|
def ORC8 : XForm_6<31, 412, (ops G8RC:$rA, G8RC:$rS, G8RC:$rB),
|
|
|
|
"orc $rA, $rS, $rB", IntGeneral,
|
|
|
|
[(set G8RC:$rA, (or G8RC:$rS, (not G8RC:$rB)))]>;
|
|
|
|
def EQV8 : XForm_6<31, 284, (ops G8RC:$rA, G8RC:$rS, G8RC:$rB),
|
|
|
|
"eqv $rA, $rS, $rB", IntGeneral,
|
|
|
|
[(set G8RC:$rA, (not (xor G8RC:$rS, G8RC:$rB)))]>;
|
|
|
|
def XOR8 : XForm_6<31, 316, (ops G8RC:$rA, G8RC:$rS, G8RC:$rB),
|
|
|
|
"xor $rA, $rS, $rB", IntGeneral,
|
|
|
|
[(set G8RC:$rA, (xor G8RC:$rS, G8RC:$rB))]>;
|
|
|
|
|
|
|
|
// Logical ops with immediate.
|
Add some 64-bit logical ops.
Split imm16Shifted into a sext/zext form for 64-bit support.
Add some patterns for immediate formation. For example, we now compile this:
static unsigned long long Y;
void test3() {
Y = 0xF0F00F00;
}
into:
_test3:
li r2, 3840
lis r3, ha16(_Y)
xoris r2, r2, 61680
std r2, lo16(_Y)(r3)
blr
GCC produces:
_test3:
li r0,0
lis r2,ha16(_Y)
ori r0,r0,61680
sldi r0,r0,16
ori r0,r0,3840
std r0,lo16(_Y)(r2)
blr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28883 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-20 22:34:10 +00:00
|
|
|
def ANDIo8 : DForm_4<28, (ops G8RC:$dst, G8RC:$src1, u16imm:$src2),
|
|
|
|
"andi. $dst, $src1, $src2", IntGeneral,
|
|
|
|
[(set G8RC:$dst, (and G8RC:$src1, immZExt16:$src2))]>,
|
|
|
|
isDOT;
|
|
|
|
def ANDISo8 : DForm_4<29, (ops G8RC:$dst, G8RC:$src1, u16imm:$src2),
|
|
|
|
"andis. $dst, $src1, $src2", IntGeneral,
|
|
|
|
[(set G8RC:$dst, (and G8RC:$src1,imm16ShiftedZExt:$src2))]>,
|
|
|
|
isDOT;
|
|
|
|
def ORI8 : DForm_4<24, (ops G8RC:$dst, G8RC:$src1, u16imm:$src2),
|
|
|
|
"ori $dst, $src1, $src2", IntGeneral,
|
|
|
|
[(set G8RC:$dst, (or G8RC:$src1, immZExt16:$src2))]>;
|
|
|
|
def ORIS8 : DForm_4<25, (ops G8RC:$dst, G8RC:$src1, u16imm:$src2),
|
|
|
|
"oris $dst, $src1, $src2", IntGeneral,
|
|
|
|
[(set G8RC:$dst, (or G8RC:$src1, imm16ShiftedZExt:$src2))]>;
|
|
|
|
def XORI8 : DForm_4<26, (ops G8RC:$dst, G8RC:$src1, u16imm:$src2),
|
|
|
|
"xori $dst, $src1, $src2", IntGeneral,
|
|
|
|
[(set G8RC:$dst, (xor G8RC:$src1, immZExt16:$src2))]>;
|
|
|
|
def XORIS8 : DForm_4<27, (ops G8RC:$dst, G8RC:$src1, u16imm:$src2),
|
|
|
|
"xoris $dst, $src1, $src2", IntGeneral,
|
|
|
|
[(set G8RC:$dst, (xor G8RC:$src1, imm16ShiftedZExt:$src2))]>;
|
|
|
|
|
2006-06-16 20:22:01 +00:00
|
|
|
def ADD8 : XOForm_1<31, 266, 0, (ops G8RC:$rT, G8RC:$rA, G8RC:$rB),
|
|
|
|
"add $rT, $rA, $rB", IntGeneral,
|
|
|
|
[(set G8RC:$rT, (add G8RC:$rA, G8RC:$rB))]>;
|
2006-06-26 23:53:10 +00:00
|
|
|
def ADDI8 : DForm_2<14, (ops G8RC:$rD, G8RC:$rA, s16imm64:$imm),
|
|
|
|
"addi $rD, $rA, $imm", IntGeneral,
|
|
|
|
[(set G8RC:$rD, (add G8RC:$rA, immSExt16:$imm))]>;
|
2006-06-20 21:23:06 +00:00
|
|
|
def ADDIS8 : DForm_2<15, (ops G8RC:$rD, G8RC:$rA, symbolHi64:$imm),
|
|
|
|
"addis $rD, $rA, $imm", IntGeneral,
|
Add some 64-bit logical ops.
Split imm16Shifted into a sext/zext form for 64-bit support.
Add some patterns for immediate formation. For example, we now compile this:
static unsigned long long Y;
void test3() {
Y = 0xF0F00F00;
}
into:
_test3:
li r2, 3840
lis r3, ha16(_Y)
xoris r2, r2, 61680
std r2, lo16(_Y)(r3)
blr
GCC produces:
_test3:
li r0,0
lis r2,ha16(_Y)
ori r0,r0,61680
sldi r0,r0,16
ori r0,r0,3840
std r0,lo16(_Y)(r2)
blr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28883 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-20 22:34:10 +00:00
|
|
|
[(set G8RC:$rD, (add G8RC:$rA, imm16ShiftedSExt:$imm))]>;
|
|
|
|
|
2006-06-27 18:18:41 +00:00
|
|
|
def SUBFIC8: DForm_2< 8, (ops G8RC:$rD, G8RC:$rA, s16imm64:$imm),
|
|
|
|
"subfic $rD, $rA, $imm", IntGeneral,
|
|
|
|
[(set G8RC:$rD, (subc immSExt16:$imm, G8RC:$rA))]>;
|
|
|
|
def SUBF8 : XOForm_1<31, 40, 0, (ops G8RC:$rT, G8RC:$rA, G8RC:$rB),
|
|
|
|
"subf $rT, $rA, $rB", IntGeneral,
|
|
|
|
[(set G8RC:$rT, (sub G8RC:$rB, G8RC:$rA))]>;
|
Add some 64-bit logical ops.
Split imm16Shifted into a sext/zext form for 64-bit support.
Add some patterns for immediate formation. For example, we now compile this:
static unsigned long long Y;
void test3() {
Y = 0xF0F00F00;
}
into:
_test3:
li r2, 3840
lis r3, ha16(_Y)
xoris r2, r2, 61680
std r2, lo16(_Y)(r3)
blr
GCC produces:
_test3:
li r0,0
lis r2,ha16(_Y)
ori r0,r0,61680
sldi r0,r0,16
ori r0,r0,3840
std r0,lo16(_Y)(r2)
blr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28883 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-20 22:34:10 +00:00
|
|
|
|
2006-06-20 21:23:06 +00:00
|
|
|
|
2006-06-16 20:22:01 +00:00
|
|
|
def MULHD : XOForm_1<31, 73, 0, (ops G8RC:$rT, G8RC:$rA, G8RC:$rB),
|
|
|
|
"mulhd $rT, $rA, $rB", IntMulHW,
|
|
|
|
[(set G8RC:$rT, (mulhs G8RC:$rA, G8RC:$rB))]>;
|
|
|
|
def MULHDU : XOForm_1<31, 9, 0, (ops G8RC:$rT, G8RC:$rA, G8RC:$rB),
|
|
|
|
"mulhdu $rT, $rA, $rB", IntMulHWU,
|
|
|
|
[(set G8RC:$rT, (mulhu G8RC:$rA, G8RC:$rB))]>;
|
|
|
|
|
2006-06-26 23:53:10 +00:00
|
|
|
def CMPD : XForm_16_ext<31, 0, (ops CRRC:$crD, G8RC:$rA, G8RC:$rB),
|
2006-06-16 20:22:01 +00:00
|
|
|
"cmpd $crD, $rA, $rB", IntCompare>, isPPC64;
|
2006-06-26 23:53:10 +00:00
|
|
|
def CMPLD : XForm_16_ext<31, 32, (ops CRRC:$crD, G8RC:$rA, G8RC:$rB),
|
2006-06-16 20:22:01 +00:00
|
|
|
"cmpld $crD, $rA, $rB", IntCompare>, isPPC64;
|
2006-06-26 23:53:10 +00:00
|
|
|
def CMPDI : DForm_5_ext<11, (ops CRRC:$crD, G8RC:$rA, s16imm:$imm),
|
|
|
|
"cmpdi $crD, $rA, $imm", IntCompare>, isPPC64;
|
|
|
|
def CMPLDI : DForm_6_ext<10, (ops CRRC:$dst, G8RC:$src1, u16imm:$src2),
|
|
|
|
"cmpldi $dst, $src1, $src2", IntCompare>, isPPC64;
|
2006-06-16 20:22:01 +00:00
|
|
|
|
2006-09-28 20:48:45 +00:00
|
|
|
def SLD : XForm_6<31, 27, (ops G8RC:$rA, G8RC:$rS, GPRC:$rB),
|
2006-06-16 20:22:01 +00:00
|
|
|
"sld $rA, $rS, $rB", IntRotateD,
|
2006-09-28 20:48:45 +00:00
|
|
|
[(set G8RC:$rA, (shl G8RC:$rS, GPRC:$rB))]>, isPPC64;
|
|
|
|
def SRD : XForm_6<31, 539, (ops G8RC:$rA, G8RC:$rS, GPRC:$rB),
|
2006-06-16 20:22:01 +00:00
|
|
|
"srd $rA, $rS, $rB", IntRotateD,
|
2006-09-28 20:48:45 +00:00
|
|
|
[(set G8RC:$rA, (srl G8RC:$rS, GPRC:$rB))]>, isPPC64;
|
|
|
|
def SRAD : XForm_6<31, 794, (ops G8RC:$rA, G8RC:$rS, GPRC:$rB),
|
2006-06-16 20:22:01 +00:00
|
|
|
"srad $rA, $rS, $rB", IntRotateD,
|
2006-09-28 20:48:45 +00:00
|
|
|
[(set G8RC:$rA, (sra G8RC:$rS, GPRC:$rB))]>, isPPC64;
|
2006-06-16 20:22:01 +00:00
|
|
|
def EXTSW : XForm_11<31, 986, (ops G8RC:$rA, G8RC:$rS),
|
|
|
|
"extsw $rA, $rS", IntGeneral,
|
|
|
|
[(set G8RC:$rA, (sext_inreg G8RC:$rS, i32))]>, isPPC64;
|
|
|
|
/// EXTSW_32 - Just like EXTSW, but works on '32-bit' registers.
|
|
|
|
def EXTSW_32 : XForm_11<31, 986, (ops GPRC:$rA, GPRC:$rS),
|
|
|
|
"extsw $rA, $rS", IntGeneral,
|
|
|
|
[(set GPRC:$rA, (PPCextsw_32 GPRC:$rS))]>, isPPC64;
|
2006-06-26 23:53:10 +00:00
|
|
|
def EXTSW_32_64 : XForm_11<31, 986, (ops G8RC:$rA, GPRC:$rS),
|
|
|
|
"extsw $rA, $rS", IntGeneral,
|
|
|
|
[(set G8RC:$rA, (sext GPRC:$rS))]>, isPPC64;
|
2006-06-16 20:22:01 +00:00
|
|
|
|
2006-06-27 20:07:26 +00:00
|
|
|
def SRADI : XSForm_1<31, 413, (ops G8RC:$rA, G8RC:$rS, u6imm:$SH),
|
|
|
|
"sradi $rA, $rS, $SH", IntRotateD,
|
|
|
|
[(set G8RC:$rA, (sra G8RC:$rS, (i32 imm:$SH)))]>, isPPC64;
|
|
|
|
|
2006-06-16 20:22:01 +00:00
|
|
|
def DIVD : XOForm_1<31, 489, 0, (ops G8RC:$rT, G8RC:$rA, G8RC:$rB),
|
|
|
|
"divd $rT, $rA, $rB", IntDivD,
|
|
|
|
[(set G8RC:$rT, (sdiv G8RC:$rA, G8RC:$rB))]>, isPPC64,
|
|
|
|
PPC970_DGroup_First, PPC970_DGroup_Cracked;
|
|
|
|
def DIVDU : XOForm_1<31, 457, 0, (ops G8RC:$rT, G8RC:$rA, G8RC:$rB),
|
|
|
|
"divdu $rT, $rA, $rB", IntDivD,
|
|
|
|
[(set G8RC:$rT, (udiv G8RC:$rA, G8RC:$rB))]>, isPPC64,
|
|
|
|
PPC970_DGroup_First, PPC970_DGroup_Cracked;
|
|
|
|
def MULLD : XOForm_1<31, 233, 0, (ops G8RC:$rT, G8RC:$rA, G8RC:$rB),
|
|
|
|
"mulld $rT, $rA, $rB", IntMulHD,
|
|
|
|
[(set G8RC:$rT, (mul G8RC:$rA, G8RC:$rB))]>, isPPC64;
|
|
|
|
|
2006-06-26 23:53:10 +00:00
|
|
|
|
2006-11-15 23:24:18 +00:00
|
|
|
let isCommutable = 1 in {
|
2006-06-16 20:22:01 +00:00
|
|
|
def RLDIMI : MDForm_1<30, 3,
|
|
|
|
(ops G8RC:$rA, G8RC:$rSi, G8RC:$rS, u6imm:$SH, u6imm:$MB),
|
|
|
|
"rldimi $rA, $rS, $SH, $MB", IntRotateD,
|
2006-11-15 23:24:18 +00:00
|
|
|
[]>, isPPC64, RegConstraint<"$rSi = $rA">,
|
|
|
|
NoEncode<"$rSi">;
|
2006-06-16 20:22:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Rotate instructions.
|
|
|
|
def RLDICL : MDForm_1<30, 0,
|
|
|
|
(ops G8RC:$rA, G8RC:$rS, u6imm:$SH, u6imm:$MB),
|
|
|
|
"rldicl $rA, $rS, $SH, $MB", IntRotateD,
|
|
|
|
[]>, isPPC64;
|
|
|
|
def RLDICR : MDForm_1<30, 1,
|
|
|
|
(ops G8RC:$rA, G8RC:$rS, u6imm:$SH, u6imm:$ME),
|
|
|
|
"rldicr $rA, $rS, $SH, $ME", IntRotateD,
|
|
|
|
[]>, isPPC64;
|
2006-06-26 23:53:10 +00:00
|
|
|
} // End FXU Operations.
|
2006-06-16 20:22:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Load/Store instructions.
|
|
|
|
//
|
|
|
|
|
|
|
|
|
2006-07-14 04:42:02 +00:00
|
|
|
// Sign extending loads.
|
2006-11-10 23:58:45 +00:00
|
|
|
let isLoad = 1, PPC970_Unit = 2 in {
|
2006-07-14 04:42:02 +00:00
|
|
|
def LHA8: DForm_1<42, (ops G8RC:$rD, memri:$src),
|
|
|
|
"lha $rD, $src", LdStLHA,
|
2006-10-09 20:57:25 +00:00
|
|
|
[(set G8RC:$rD, (sextloadi16 iaddr:$src))]>,
|
2006-07-14 04:42:02 +00:00
|
|
|
PPC970_DGroup_Cracked;
|
2006-06-20 00:38:36 +00:00
|
|
|
def LWA : DSForm_1<58, 2, (ops G8RC:$rD, memrix:$src),
|
|
|
|
"lwa $rD, $src", LdStLWA,
|
2006-10-09 20:57:25 +00:00
|
|
|
[(set G8RC:$rD, (sextloadi32 ixaddr:$src))]>, isPPC64,
|
2006-06-20 00:38:36 +00:00
|
|
|
PPC970_DGroup_Cracked;
|
2006-07-14 04:42:02 +00:00
|
|
|
def LHAX8: XForm_1<31, 343, (ops G8RC:$rD, memrr:$src),
|
|
|
|
"lhax $rD, $src", LdStLHA,
|
2006-10-09 20:57:25 +00:00
|
|
|
[(set G8RC:$rD, (sextloadi16 xaddr:$src))]>,
|
2006-07-14 04:42:02 +00:00
|
|
|
PPC970_DGroup_Cracked;
|
2006-06-16 20:22:01 +00:00
|
|
|
def LWAX : XForm_1<31, 341, (ops G8RC:$rD, memrr:$src),
|
|
|
|
"lwax $rD, $src", LdStLHA,
|
2006-10-09 20:57:25 +00:00
|
|
|
[(set G8RC:$rD, (sextloadi32 xaddr:$src))]>, isPPC64,
|
2006-06-16 20:22:01 +00:00
|
|
|
PPC970_DGroup_Cracked;
|
2006-07-14 04:42:02 +00:00
|
|
|
|
2006-11-10 23:58:45 +00:00
|
|
|
// Update forms.
|
2006-11-15 23:24:18 +00:00
|
|
|
def LHAU8 : DForm_1<43, (ops G8RC:$rD, ptr_rc:$ea_result, symbolLo:$disp,
|
2006-11-10 23:58:45 +00:00
|
|
|
ptr_rc:$rA),
|
|
|
|
"lhau $rD, $disp($rA)", LdStGeneral,
|
2006-11-15 23:24:18 +00:00
|
|
|
[]>, RegConstraint<"$rA = $ea_result">,
|
|
|
|
NoEncode<"$ea_result">;
|
2006-11-10 23:58:45 +00:00
|
|
|
// NO LWAU!
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2006-07-14 04:42:02 +00:00
|
|
|
// Zero extending loads.
|
2006-11-10 23:58:45 +00:00
|
|
|
let isLoad = 1, PPC970_Unit = 2 in {
|
2006-07-14 04:42:02 +00:00
|
|
|
def LBZ8 : DForm_1<34, (ops G8RC:$rD, memri:$src),
|
|
|
|
"lbz $rD, $src", LdStGeneral,
|
2006-10-09 20:57:25 +00:00
|
|
|
[(set G8RC:$rD, (zextloadi8 iaddr:$src))]>;
|
2006-07-14 04:42:02 +00:00
|
|
|
def LHZ8 : DForm_1<40, (ops G8RC:$rD, memri:$src),
|
|
|
|
"lhz $rD, $src", LdStGeneral,
|
2006-10-09 20:57:25 +00:00
|
|
|
[(set G8RC:$rD, (zextloadi16 iaddr:$src))]>;
|
2006-06-27 17:30:08 +00:00
|
|
|
def LWZ8 : DForm_1<32, (ops G8RC:$rD, memri:$src),
|
|
|
|
"lwz $rD, $src", LdStGeneral,
|
2006-10-09 20:57:25 +00:00
|
|
|
[(set G8RC:$rD, (zextloadi32 iaddr:$src))]>, isPPC64;
|
2006-07-14 04:42:02 +00:00
|
|
|
|
|
|
|
def LBZX8 : XForm_1<31, 87, (ops G8RC:$rD, memrr:$src),
|
|
|
|
"lbzx $rD, $src", LdStGeneral,
|
2006-10-09 20:57:25 +00:00
|
|
|
[(set G8RC:$rD, (zextloadi8 xaddr:$src))]>;
|
2006-07-14 04:42:02 +00:00
|
|
|
def LHZX8 : XForm_1<31, 279, (ops G8RC:$rD, memrr:$src),
|
|
|
|
"lhzx $rD, $src", LdStGeneral,
|
2006-10-09 20:57:25 +00:00
|
|
|
[(set G8RC:$rD, (zextloadi16 xaddr:$src))]>;
|
2006-07-14 04:42:02 +00:00
|
|
|
def LWZX8 : XForm_1<31, 23, (ops G8RC:$rD, memrr:$src),
|
|
|
|
"lwzx $rD, $src", LdStGeneral,
|
2006-10-09 20:57:25 +00:00
|
|
|
[(set G8RC:$rD, (zextloadi32 xaddr:$src))]>;
|
2006-11-10 23:58:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Update forms.
|
2006-11-15 19:55:13 +00:00
|
|
|
def LBZU8 : DForm_1<35, (ops G8RC:$rD, ptr_rc:$ea_result, memri:$addr),
|
|
|
|
"lbzu $rD, $addr", LdStGeneral,
|
2006-11-15 23:24:18 +00:00
|
|
|
[]>, RegConstraint<"$addr.reg = $ea_result">,
|
|
|
|
NoEncode<"$ea_result">;
|
2006-11-15 19:55:13 +00:00
|
|
|
def LHZU8 : DForm_1<41, (ops G8RC:$rD, ptr_rc:$ea_result, memri:$addr),
|
|
|
|
"lhzu $rD, $addr", LdStGeneral,
|
2006-11-15 23:24:18 +00:00
|
|
|
[]>, RegConstraint<"$addr.reg = $ea_result">,
|
|
|
|
NoEncode<"$ea_result">;
|
2006-11-15 19:55:13 +00:00
|
|
|
def LWZU8 : DForm_1<33, (ops G8RC:$rD, ptr_rc:$ea_result, memri:$addr),
|
|
|
|
"lwzu $rD, $addr", LdStGeneral,
|
2006-11-15 23:24:18 +00:00
|
|
|
[]>, RegConstraint<"$addr.reg = $ea_result">,
|
|
|
|
NoEncode<"$ea_result">;
|
2006-11-10 23:58:45 +00:00
|
|
|
}
|
2006-07-14 04:42:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Full 8-byte loads.
|
2006-11-10 23:58:45 +00:00
|
|
|
let isLoad = 1, PPC970_Unit = 2 in {
|
|
|
|
def LD : DSForm_1<58, 0, (ops G8RC:$rD, memrix:$src),
|
2006-07-14 04:42:02 +00:00
|
|
|
"ld $rD, $src", LdStLD,
|
|
|
|
[(set G8RC:$rD, (load ixaddr:$src))]>, isPPC64;
|
|
|
|
def LDX : XForm_1<31, 21, (ops G8RC:$rD, memrr:$src),
|
|
|
|
"ldx $rD, $src", LdStLD,
|
|
|
|
[(set G8RC:$rD, (load xaddr:$src))]>, isPPC64;
|
2006-11-10 23:58:45 +00:00
|
|
|
|
2006-11-15 19:55:13 +00:00
|
|
|
def LDU : DSForm_1<58, 1, (ops G8RC:$rD, ptr_rc:$ea_result, memrix:$addr),
|
|
|
|
"ldu $rD, $addr", LdStLD,
|
2006-11-15 23:24:18 +00:00
|
|
|
[]>, RegConstraint<"$addr.reg = $ea_result">, isPPC64,
|
|
|
|
NoEncode<"$ea_result">;
|
2006-11-10 23:58:45 +00:00
|
|
|
|
2006-06-16 20:22:01 +00:00
|
|
|
}
|
2006-07-14 04:42:02 +00:00
|
|
|
|
2006-06-16 20:22:01 +00:00
|
|
|
let isStore = 1, noResults = 1, PPC970_Unit = 2 in {
|
2006-07-14 04:42:02 +00:00
|
|
|
// Truncating stores.
|
2006-11-15 23:24:18 +00:00
|
|
|
def STB8 : DForm_1<38, (ops G8RC:$rS, memri:$src),
|
2006-07-14 04:42:02 +00:00
|
|
|
"stb $rS, $src", LdStGeneral,
|
2006-10-13 21:14:26 +00:00
|
|
|
[(truncstorei8 G8RC:$rS, iaddr:$src)]>;
|
2006-11-15 23:24:18 +00:00
|
|
|
def STH8 : DForm_1<44, (ops G8RC:$rS, memri:$src),
|
2006-07-14 04:42:02 +00:00
|
|
|
"sth $rS, $src", LdStGeneral,
|
2006-10-13 21:14:26 +00:00
|
|
|
[(truncstorei16 G8RC:$rS, iaddr:$src)]>;
|
2006-11-15 23:24:18 +00:00
|
|
|
def STW8 : DForm_1<36, (ops G8RC:$rS, memri:$src),
|
2006-07-14 04:42:02 +00:00
|
|
|
"stw $rS, $src", LdStGeneral,
|
2006-10-13 21:14:26 +00:00
|
|
|
[(truncstorei32 G8RC:$rS, iaddr:$src)]>;
|
2006-07-14 04:42:02 +00:00
|
|
|
def STBX8 : XForm_8<31, 215, (ops G8RC:$rS, memrr:$dst),
|
|
|
|
"stbx $rS, $dst", LdStGeneral,
|
2006-10-13 21:14:26 +00:00
|
|
|
[(truncstorei8 G8RC:$rS, xaddr:$dst)]>,
|
2006-07-14 04:42:02 +00:00
|
|
|
PPC970_DGroup_Cracked;
|
|
|
|
def STHX8 : XForm_8<31, 407, (ops G8RC:$rS, memrr:$dst),
|
|
|
|
"sthx $rS, $dst", LdStGeneral,
|
2006-10-13 21:14:26 +00:00
|
|
|
[(truncstorei16 G8RC:$rS, xaddr:$dst)]>,
|
2006-07-14 04:42:02 +00:00
|
|
|
PPC970_DGroup_Cracked;
|
|
|
|
def STWX8 : XForm_8<31, 151, (ops G8RC:$rS, memrr:$dst),
|
|
|
|
"stwx $rS, $dst", LdStGeneral,
|
2006-10-13 21:14:26 +00:00
|
|
|
[(truncstorei32 G8RC:$rS, xaddr:$dst)]>,
|
2006-07-14 04:42:02 +00:00
|
|
|
PPC970_DGroup_Cracked;
|
2006-11-16 00:57:19 +00:00
|
|
|
// Normal 8-byte stores.
|
|
|
|
def STD : DSForm_1<62, 0, (ops G8RC:$rS, memrix:$dst),
|
|
|
|
"std $rS, $dst", LdStSTD,
|
|
|
|
[(store G8RC:$rS, ixaddr:$dst)]>, isPPC64;
|
|
|
|
def STDX : XForm_8<31, 149, (ops G8RC:$rS, memrr:$dst),
|
|
|
|
"stdx $rS, $dst", LdStSTD,
|
|
|
|
[(store G8RC:$rS, xaddr:$dst)]>, isPPC64,
|
|
|
|
PPC970_DGroup_Cracked;
|
|
|
|
}
|
|
|
|
|
|
|
|
let isStore = 1, PPC970_Unit = 2 in {
|
|
|
|
|
|
|
|
def STBU8 : DForm_1<38, (ops ptr_rc:$ea_res, G8RC:$rS,
|
|
|
|
symbolLo:$ptroff, ptr_rc:$ptrreg),
|
|
|
|
"stbu $rS, $ptroff($ptrreg)", LdStGeneral,
|
|
|
|
[(set ptr_rc:$ea_res,
|
|
|
|
(pre_truncsti8 G8RC:$rS, ptr_rc:$ptrreg,
|
|
|
|
iaddroff:$ptroff))]>,
|
|
|
|
RegConstraint<"$ptrreg = $ea_res">, NoEncode<"$ea_res">;
|
|
|
|
def STHU8 : DForm_1<45, (ops ptr_rc:$ea_res, G8RC:$rS,
|
|
|
|
symbolLo:$ptroff, ptr_rc:$ptrreg),
|
|
|
|
"sthu $rS, $ptroff($ptrreg)", LdStGeneral,
|
|
|
|
[(set ptr_rc:$ea_res,
|
|
|
|
(pre_truncsti16 G8RC:$rS, ptr_rc:$ptrreg,
|
|
|
|
iaddroff:$ptroff))]>,
|
|
|
|
RegConstraint<"$ptrreg = $ea_res">, NoEncode<"$ea_res">;
|
|
|
|
def STWU8 : DForm_1<37, (ops ptr_rc:$ea_res, G8RC:$rS,
|
|
|
|
symbolLo:$ptroff, ptr_rc:$ptrreg),
|
|
|
|
"stwu $rS, $ptroff($ptrreg)", LdStGeneral,
|
|
|
|
[(set ptr_rc:$ea_res, (pre_store G8RC:$rS, ptr_rc:$ptrreg,
|
|
|
|
iaddroff:$ptroff))]>,
|
|
|
|
RegConstraint<"$ptrreg = $ea_res">, NoEncode<"$ea_res">;
|
|
|
|
|
|
|
|
|
|
|
|
def STDU : DSForm_1<62, 1, (ops ptr_rc:$ea_res, G8RC:$rS,
|
|
|
|
symbolLo:$ptroff, ptr_rc:$ptrreg),
|
|
|
|
"stdu $rS, $ptroff($ptrreg)", LdStSTD,
|
|
|
|
[(set ptr_rc:$ea_res, (pre_store G8RC:$rS, ptr_rc:$ptrreg,
|
|
|
|
iaddroff:$ptroff))]>,
|
|
|
|
RegConstraint<"$ptrreg = $ea_res">, NoEncode<"$ea_res">,
|
|
|
|
isPPC64;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
let isStore = 1, noResults = 1, PPC970_Unit = 2 in {
|
|
|
|
|
|
|
|
def STDUX : XForm_8<31, 181, (ops G8RC:$rS, memrr:$dst),
|
|
|
|
"stdux $rS, $dst", LdStSTD,
|
|
|
|
[]>, isPPC64;
|
|
|
|
|
|
|
|
|
|
|
|
// STD_32/STDX_32 - Just like STD/STDX, but uses a '32-bit' input register.
|
|
|
|
def STD_32 : DSForm_1<62, 0, (ops GPRC:$rT, memrix:$dst),
|
|
|
|
"std $rT, $dst", LdStSTD,
|
|
|
|
[(PPCstd_32 GPRC:$rT, ixaddr:$dst)]>, isPPC64;
|
|
|
|
def STDX_32 : XForm_8<31, 149, (ops GPRC:$rT, memrr:$dst),
|
|
|
|
"stdx $rT, $dst", LdStSTD,
|
|
|
|
[(PPCstd_32 GPRC:$rT, xaddr:$dst)]>, isPPC64,
|
|
|
|
PPC970_DGroup_Cracked;
|
2006-06-16 20:22:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Floating point instructions.
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
let PPC970_Unit = 3 in { // FPU Operations.
|
|
|
|
def FCFID : XForm_26<63, 846, (ops F8RC:$frD, F8RC:$frB),
|
|
|
|
"fcfid $frD, $frB", FPGeneral,
|
|
|
|
[(set F8RC:$frD, (PPCfcfid F8RC:$frB))]>, isPPC64;
|
|
|
|
def FCTIDZ : XForm_26<63, 815, (ops F8RC:$frD, F8RC:$frB),
|
|
|
|
"fctidz $frD, $frB", FPGeneral,
|
|
|
|
[(set F8RC:$frD, (PPCfctidz F8RC:$frB))]>, isPPC64;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Instruction Patterns
|
|
|
|
//
|
Add some 64-bit logical ops.
Split imm16Shifted into a sext/zext form for 64-bit support.
Add some patterns for immediate formation. For example, we now compile this:
static unsigned long long Y;
void test3() {
Y = 0xF0F00F00;
}
into:
_test3:
li r2, 3840
lis r3, ha16(_Y)
xoris r2, r2, 61680
std r2, lo16(_Y)(r3)
blr
GCC produces:
_test3:
li r0,0
lis r2,ha16(_Y)
ori r0,r0,61680
sldi r0,r0,16
ori r0,r0,3840
std r0,lo16(_Y)(r2)
blr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28883 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-20 22:34:10 +00:00
|
|
|
|
|
|
|
// Immediate support.
|
|
|
|
// Handled above:
|
|
|
|
// sext(0x0000_0000_0000_FFFF, i8) -> li imm
|
|
|
|
// sext(0x0000_0000_FFFF_0000, i16) -> lis imm>>16
|
|
|
|
|
|
|
|
// sext(0x0000_0000_FFFF_FFFF, i16) -> lis + ori
|
|
|
|
def sext_0x0000_0000_FFFF_FFFF_i16 : PatLeaf<(imm), [{
|
|
|
|
return N->getValue() == (uint64_t)(int32_t)N->getValue();
|
|
|
|
}]>;
|
|
|
|
def : Pat<(i64 sext_0x0000_0000_FFFF_FFFF_i16:$imm),
|
|
|
|
(ORI8 (LIS8 (HI16 imm:$imm)), (LO16 imm:$imm))>;
|
|
|
|
|
2006-06-20 22:38:59 +00:00
|
|
|
// zext(0x0000_0000_FFFF_7FFF, i16) -> oris (li lo16(imm)), imm>>16
|
|
|
|
def zext_0x0000_0000_FFFF_7FFF_i16 : PatLeaf<(imm), [{
|
|
|
|
return (N->getValue() & 0xFFFFFFFF00008000ULL) == 0;
|
Add some 64-bit logical ops.
Split imm16Shifted into a sext/zext form for 64-bit support.
Add some patterns for immediate formation. For example, we now compile this:
static unsigned long long Y;
void test3() {
Y = 0xF0F00F00;
}
into:
_test3:
li r2, 3840
lis r3, ha16(_Y)
xoris r2, r2, 61680
std r2, lo16(_Y)(r3)
blr
GCC produces:
_test3:
li r0,0
lis r2,ha16(_Y)
ori r0,r0,61680
sldi r0,r0,16
ori r0,r0,3840
std r0,lo16(_Y)(r2)
blr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28883 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-20 22:34:10 +00:00
|
|
|
}]>;
|
2006-06-20 22:38:59 +00:00
|
|
|
def : Pat<(i64 zext_0x0000_0000_FFFF_7FFF_i16:$imm),
|
|
|
|
(ORIS8 (LI8 (LO16 imm:$imm)), (HI16 imm:$imm))>;
|
Add some 64-bit logical ops.
Split imm16Shifted into a sext/zext form for 64-bit support.
Add some patterns for immediate formation. For example, we now compile this:
static unsigned long long Y;
void test3() {
Y = 0xF0F00F00;
}
into:
_test3:
li r2, 3840
lis r3, ha16(_Y)
xoris r2, r2, 61680
std r2, lo16(_Y)(r3)
blr
GCC produces:
_test3:
li r0,0
lis r2,ha16(_Y)
ori r0,r0,61680
sldi r0,r0,16
ori r0,r0,3840
std r0,lo16(_Y)(r2)
blr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28883 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-20 22:34:10 +00:00
|
|
|
|
Add some more immediate patterns. This allows us to compile:
void test6() {
Y = 0xABCD0123BCDE4567;
}
into:
_test6:
lis r2, -21555
lis r3, ha16(_Y)
ori r2, r2, 291
rldicr r2, r2, 32, 31
oris r2, r2, 48350
ori r2, r2, 17767
std r2, lo16(_Y)(r3)
blr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28885 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-20 23:03:01 +00:00
|
|
|
// zext(0x0000_0000_FFFF_FFFF, i16) -> oris (ori (li 0), lo16(imm)), imm>>16
|
|
|
|
def zext_0x0000_0000_FFFF_FFFF_i16 : PatLeaf<(imm), [{
|
|
|
|
return (N->getValue() & 0xFFFFFFFF00000000ULL) == 0;
|
|
|
|
}]>;
|
|
|
|
def : Pat<(i64 zext_0x0000_0000_FFFF_FFFF_i16:$imm),
|
|
|
|
(ORIS8 (ORI8 (LI8 0), (LO16 imm:$imm)), (HI16 imm:$imm))>;
|
|
|
|
|
2006-06-20 23:11:59 +00:00
|
|
|
// FIXME: Handle smart forms where the top 32-bits are set. Right now, stuff
|
|
|
|
// like 0xABCD0123BCDE0000 hits the case below, which produces ORI R, R, 0's!
|
Add some more immediate patterns. This allows us to compile:
void test6() {
Y = 0xABCD0123BCDE4567;
}
into:
_test6:
lis r2, -21555
lis r3, ha16(_Y)
ori r2, r2, 291
rldicr r2, r2, 32, 31
oris r2, r2, 48350
ori r2, r2, 17767
std r2, lo16(_Y)(r3)
blr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28885 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-20 23:03:01 +00:00
|
|
|
|
|
|
|
// Fully general (and most expensive: 6 instructions!) immediate pattern.
|
|
|
|
def : Pat<(i64 imm:$imm),
|
|
|
|
(ORI8
|
|
|
|
(ORIS8
|
|
|
|
(RLDICR
|
|
|
|
(ORI8
|
|
|
|
(LIS8 (HI48_64 imm:$imm)),
|
|
|
|
(HI32_48 imm:$imm)),
|
|
|
|
32, 31),
|
|
|
|
(HI16 imm:$imm)),
|
|
|
|
(LO16 imm:$imm))>;
|
Add some 64-bit logical ops.
Split imm16Shifted into a sext/zext form for 64-bit support.
Add some patterns for immediate formation. For example, we now compile this:
static unsigned long long Y;
void test3() {
Y = 0xF0F00F00;
}
into:
_test3:
li r2, 3840
lis r3, ha16(_Y)
xoris r2, r2, 61680
std r2, lo16(_Y)(r3)
blr
GCC produces:
_test3:
li r0,0
lis r2,ha16(_Y)
ori r0,r0,61680
sldi r0,r0,16
ori r0,r0,3840
std r0,lo16(_Y)(r2)
blr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28883 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-20 22:34:10 +00:00
|
|
|
|
|
|
|
|
2006-06-16 20:22:01 +00:00
|
|
|
// Extensions and truncates to/from 32-bit regs.
|
|
|
|
def : Pat<(i64 (zext GPRC:$in)),
|
|
|
|
(RLDICL (OR4To8 GPRC:$in, GPRC:$in), 0, 32)>;
|
|
|
|
def : Pat<(i64 (anyext GPRC:$in)),
|
|
|
|
(OR4To8 GPRC:$in, GPRC:$in)>;
|
|
|
|
def : Pat<(i32 (trunc G8RC:$in)),
|
|
|
|
(OR8To4 G8RC:$in, G8RC:$in)>;
|
|
|
|
|
2006-07-14 04:42:02 +00:00
|
|
|
// Extending loads with i64 targets.
|
2006-10-09 20:57:25 +00:00
|
|
|
def : Pat<(zextloadi1 iaddr:$src),
|
2006-07-14 04:42:02 +00:00
|
|
|
(LBZ8 iaddr:$src)>;
|
2006-10-09 20:57:25 +00:00
|
|
|
def : Pat<(zextloadi1 xaddr:$src),
|
2006-07-14 04:42:02 +00:00
|
|
|
(LBZX8 xaddr:$src)>;
|
2006-10-09 20:57:25 +00:00
|
|
|
def : Pat<(extloadi1 iaddr:$src),
|
2006-07-14 04:42:02 +00:00
|
|
|
(LBZ8 iaddr:$src)>;
|
2006-10-09 20:57:25 +00:00
|
|
|
def : Pat<(extloadi1 xaddr:$src),
|
2006-07-14 04:42:02 +00:00
|
|
|
(LBZX8 xaddr:$src)>;
|
2006-10-09 20:57:25 +00:00
|
|
|
def : Pat<(extloadi8 iaddr:$src),
|
2006-07-14 04:42:02 +00:00
|
|
|
(LBZ8 iaddr:$src)>;
|
2006-10-09 20:57:25 +00:00
|
|
|
def : Pat<(extloadi8 xaddr:$src),
|
2006-07-14 04:42:02 +00:00
|
|
|
(LBZX8 xaddr:$src)>;
|
2006-10-09 20:57:25 +00:00
|
|
|
def : Pat<(extloadi16 iaddr:$src),
|
2006-07-14 04:42:02 +00:00
|
|
|
(LHZ8 iaddr:$src)>;
|
2006-10-09 20:57:25 +00:00
|
|
|
def : Pat<(extloadi16 xaddr:$src),
|
2006-07-14 04:42:02 +00:00
|
|
|
(LHZX8 xaddr:$src)>;
|
2006-10-09 20:57:25 +00:00
|
|
|
def : Pat<(extloadi32 iaddr:$src),
|
2006-07-14 04:42:02 +00:00
|
|
|
(LWZ8 iaddr:$src)>;
|
2006-10-09 20:57:25 +00:00
|
|
|
def : Pat<(extloadi32 xaddr:$src),
|
2006-07-14 04:42:02 +00:00
|
|
|
(LWZX8 xaddr:$src)>;
|
|
|
|
|
2006-06-16 20:22:01 +00:00
|
|
|
// SHL/SRL
|
2006-06-27 18:18:41 +00:00
|
|
|
def : Pat<(shl G8RC:$in, (i32 imm:$imm)),
|
2006-06-16 20:22:01 +00:00
|
|
|
(RLDICR G8RC:$in, imm:$imm, (SHL64 imm:$imm))>;
|
2006-06-27 18:18:41 +00:00
|
|
|
def : Pat<(srl G8RC:$in, (i32 imm:$imm)),
|
2006-06-16 20:22:01 +00:00
|
|
|
(RLDICL G8RC:$in, (SRL64 imm:$imm), imm:$imm)>;
|
2006-06-20 21:23:06 +00:00
|
|
|
|
|
|
|
// Hi and Lo for Darwin Global Addresses.
|
|
|
|
def : Pat<(PPChi tglobaladdr:$in, 0), (LIS8 tglobaladdr:$in)>;
|
|
|
|
def : Pat<(PPClo tglobaladdr:$in, 0), (LI8 tglobaladdr:$in)>;
|
|
|
|
def : Pat<(PPChi tconstpool:$in , 0), (LIS8 tconstpool:$in)>;
|
|
|
|
def : Pat<(PPClo tconstpool:$in , 0), (LI8 tconstpool:$in)>;
|
|
|
|
def : Pat<(PPChi tjumptable:$in , 0), (LIS8 tjumptable:$in)>;
|
|
|
|
def : Pat<(PPClo tjumptable:$in , 0), (LI8 tjumptable:$in)>;
|
|
|
|
def : Pat<(add G8RC:$in, (PPChi tglobaladdr:$g, 0)),
|
|
|
|
(ADDIS8 G8RC:$in, tglobaladdr:$g)>;
|
|
|
|
def : Pat<(add G8RC:$in, (PPChi tconstpool:$g, 0)),
|
|
|
|
(ADDIS8 G8RC:$in, tconstpool:$g)>;
|
|
|
|
def : Pat<(add G8RC:$in, (PPChi tjumptable:$g, 0)),
|
|
|
|
(ADDIS8 G8RC:$in, tjumptable:$g)>;
|