mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-21 03:32:21 +00:00
[ARMv8] Add CRC instructions.
Patch by Bradley Smith! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190928 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
163df38bdf
commit
a4d46d7fc6
@ -96,6 +96,22 @@ def int_arm_mcrr2 : GCCBuiltin<"__builtin_arm_mcrr2">,
|
||||
Intrinsic<[], [llvm_i32_ty, llvm_i32_ty, llvm_i32_ty,
|
||||
llvm_i32_ty, llvm_i32_ty], []>;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// CRC32
|
||||
|
||||
def int_arm_crc32b : Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty],
|
||||
[IntrNoMem]>;
|
||||
def int_arm_crc32cb : Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty],
|
||||
[IntrNoMem]>;
|
||||
def int_arm_crc32h : Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty],
|
||||
[IntrNoMem]>;
|
||||
def int_arm_crc32ch : Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty],
|
||||
[IntrNoMem]>;
|
||||
def int_arm_crc32w : Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty],
|
||||
[IntrNoMem]>;
|
||||
def int_arm_crc32cw : Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty],
|
||||
[IntrNoMem]>;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Advanced SIMD (NEON)
|
||||
|
||||
|
@ -4046,6 +4046,45 @@ def : ARMV6Pat<(or (and GPRnopc:$src1, 0xFFFF0000),
|
||||
(and (srl GPRnopc:$src2, imm1_15:$sh), 0xFFFF)),
|
||||
(PKHTB GPRnopc:$src1, GPRnopc:$src2, imm1_15:$sh)>;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// CRC Instructions
|
||||
//
|
||||
// Polynomials:
|
||||
// + CRC32{B,H,W} 0x04C11DB7
|
||||
// + CRC32C{B,H,W} 0x1EDC6F41
|
||||
//
|
||||
|
||||
class AI_crc32<bit C, bits<2> sz, string suffix, SDPatternOperator builtin>
|
||||
: AInoP<(outs GPRnopc:$Rd), (ins GPRnopc:$Rn, GPRnopc:$Rm), MiscFrm, NoItinerary,
|
||||
!strconcat("crc32", suffix), "\t$Rd, $Rn, $Rm",
|
||||
[(set GPRnopc:$Rd, (builtin GPRnopc:$Rn, GPRnopc:$Rm))]>,
|
||||
Requires<[IsARM, HasV8]> {
|
||||
bits<4> Rd;
|
||||
bits<4> Rn;
|
||||
bits<4> Rm;
|
||||
|
||||
let Inst{31-28} = 0b1110;
|
||||
let Inst{27-23} = 0b00010;
|
||||
let Inst{22-21} = sz;
|
||||
let Inst{20} = 0;
|
||||
let Inst{19-16} = Rn;
|
||||
let Inst{15-12} = Rd;
|
||||
let Inst{11-10} = 0b00;
|
||||
let Inst{9} = C;
|
||||
let Inst{8} = 0;
|
||||
let Inst{7-4} = 0b0100;
|
||||
let Inst{3-0} = Rm;
|
||||
|
||||
let Unpredictable{11-8} = 0b1101;
|
||||
}
|
||||
|
||||
def CRC32B : AI_crc32<0, 0b00, "b", int_arm_crc32b>;
|
||||
def CRC32CB : AI_crc32<1, 0b00, "cb", int_arm_crc32cb>;
|
||||
def CRC32H : AI_crc32<0, 0b01, "h", int_arm_crc32h>;
|
||||
def CRC32CH : AI_crc32<1, 0b01, "ch", int_arm_crc32ch>;
|
||||
def CRC32W : AI_crc32<0, 0b10, "w", int_arm_crc32w>;
|
||||
def CRC32CW : AI_crc32<1, 0b10, "cw", int_arm_crc32cw>;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Comparison Instructions...
|
||||
//
|
||||
|
@ -465,6 +465,18 @@ class T2ThreeReg<dag oops, dag iops, InstrItinClass itin,
|
||||
let Inst{3-0} = Rm;
|
||||
}
|
||||
|
||||
class T2ThreeRegNoP<dag oops, dag iops, InstrItinClass itin,
|
||||
string asm, list<dag> pattern>
|
||||
: T2XI<oops, iops, itin, asm, pattern> {
|
||||
bits<4> Rd;
|
||||
bits<4> Rn;
|
||||
bits<4> Rm;
|
||||
|
||||
let Inst{11-8} = Rd;
|
||||
let Inst{19-16} = Rn;
|
||||
let Inst{3-0} = Rm;
|
||||
}
|
||||
|
||||
class T2sThreeReg<dag oops, dag iops, InstrItinClass itin,
|
||||
string opc, string asm, list<dag> pattern>
|
||||
: T2sI<oops, iops, itin, opc, asm, pattern> {
|
||||
@ -3003,6 +3015,34 @@ def : T2Pat<(or (and rGPR:$src1, 0xFFFF0000),
|
||||
(t2PKHTB rGPR:$src1, rGPR:$src2, imm1_15:$sh)>,
|
||||
Requires<[HasT2ExtractPack, IsThumb2]>;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// CRC32 Instructions
|
||||
//
|
||||
// Polynomials:
|
||||
// + CRC32{B,H,W} 0x04C11DB7
|
||||
// + CRC32C{B,H,W} 0x1EDC6F41
|
||||
//
|
||||
|
||||
class T2I_crc32<bit C, bits<2> sz, string suffix, SDPatternOperator builtin>
|
||||
: T2ThreeRegNoP<(outs rGPR:$Rd), (ins rGPR:$Rn, rGPR:$Rm), NoItinerary,
|
||||
!strconcat("crc32", suffix, "\t$Rd, $Rn, $Rm"),
|
||||
[(set rGPR:$Rd, (builtin rGPR:$Rn, rGPR:$Rm))]>,
|
||||
Requires<[IsThumb2, HasV8]> {
|
||||
let Inst{31-27} = 0b11111;
|
||||
let Inst{26-21} = 0b010110;
|
||||
let Inst{20} = C;
|
||||
let Inst{15-12} = 0b1111;
|
||||
let Inst{7-6} = 0b10;
|
||||
let Inst{5-4} = sz;
|
||||
}
|
||||
|
||||
def t2CRC32B : T2I_crc32<0, 0b00, "b", int_arm_crc32b>;
|
||||
def t2CRC32CB : T2I_crc32<1, 0b00, "cb", int_arm_crc32cb>;
|
||||
def t2CRC32H : T2I_crc32<0, 0b01, "h", int_arm_crc32h>;
|
||||
def t2CRC32CH : T2I_crc32<1, 0b01, "ch", int_arm_crc32ch>;
|
||||
def t2CRC32W : T2I_crc32<0, 0b10, "w", int_arm_crc32w>;
|
||||
def t2CRC32CW : T2I_crc32<1, 0b10, "cw", int_arm_crc32cw>;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Comparison Instructions...
|
||||
//
|
||||
|
@ -4803,7 +4803,7 @@ getMnemonicAcceptInfo(StringRef Mnemonic, bool &CanAcceptCarrySet,
|
||||
|
||||
if (Mnemonic == "bkpt" || Mnemonic == "cbnz" || Mnemonic == "setend" ||
|
||||
Mnemonic == "cps" || Mnemonic == "it" || Mnemonic == "cbz" ||
|
||||
Mnemonic == "trap" || Mnemonic == "hlt" ||
|
||||
Mnemonic == "trap" || Mnemonic == "hlt" || Mnemonic.startswith("crc32") ||
|
||||
Mnemonic.startswith("cps") || Mnemonic.startswith("vsel") ||
|
||||
Mnemonic == "vmaxnm" || Mnemonic == "vminnm" || Mnemonic == "vcvta" ||
|
||||
Mnemonic == "vcvtn" || Mnemonic == "vcvtp" || Mnemonic == "vcvtm" ||
|
||||
|
Loading…
x
Reference in New Issue
Block a user