mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-01 17:28:21 +00:00
Partial support for Intel SHA Extensions (sha1rnds4)
Add basic assembly/disassembly support for the first Intel SHA instruction 'sha1rnds4'. Also includes feature flag, and test cases. Support for the remaining instructions will follow in a separate patch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190611 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c0b12dfd0a
commit
1f1bd9a54d
@ -137,6 +137,9 @@ def FeatureHLE : SubtargetFeature<"hle", "HasHLE", "true",
|
||||
"Support HLE">;
|
||||
def FeatureADX : SubtargetFeature<"adx", "HasADX", "true",
|
||||
"Support ADX instructions">;
|
||||
def FeatureSHA : SubtargetFeature<"sha", "HasSHA", "true",
|
||||
"Enable SHA instructions",
|
||||
[FeatureSSE2]>;
|
||||
def FeaturePRFCHW : SubtargetFeature<"prfchw", "HasPRFCHW", "true",
|
||||
"Support PRFCHW instructions">;
|
||||
def FeatureRDSEED : SubtargetFeature<"rdseed", "HasRDSEED", "true",
|
||||
|
@ -675,6 +675,7 @@ def HasRTM : Predicate<"Subtarget->hasRTM()">;
|
||||
def HasHLE : Predicate<"Subtarget->hasHLE()">;
|
||||
def HasTSX : Predicate<"Subtarget->hasRTM() || Subtarget->hasHLE()">;
|
||||
def HasADX : Predicate<"Subtarget->hasADX()">;
|
||||
def HasSHA : Predicate<"Subtarget->hasSHA()">;
|
||||
def HasPRFCHW : Predicate<"Subtarget->hasPRFCHW()">;
|
||||
def HasRDSEED : Predicate<"Subtarget->hasRDSEED()">;
|
||||
def HasPrefetchW : Predicate<"Subtarget->has3DNow() || Subtarget->hasPRFCHW()">;
|
||||
|
@ -7320,6 +7320,22 @@ let Constraints = "$src1 = $dst" in {
|
||||
REX_W;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// SHA-NI Instructions
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
let Constraints = "$src1 = $dst", hasSideEffects = 0, Predicates = [HasSHA] in {
|
||||
def SHA1RNDS4rri : Ii8<0xCC, MRMSrcReg, (outs VR128:$dst),
|
||||
(ins VR128:$src1, VR128:$src2, i8imm:$src3),
|
||||
"sha1rnds4\t{$src3, $src2, $dst|$dst, $src2, $src3}",
|
||||
[]>, TA;
|
||||
let mayLoad = 1 in
|
||||
def SHA1RNDS4rmi : Ii8<0xCC, MRMSrcMem, (outs VR128:$dst),
|
||||
(ins VR128:$src1, i128mem:$src2, i8imm:$src3),
|
||||
"sha1rnds4\t{$src3, $src2, $dst|$dst, $src2, $src3}",
|
||||
[]>, TA;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// AES-NI Instructions
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -375,6 +375,10 @@ void X86Subtarget::AutoDetectSubtargetFeatures() {
|
||||
HasCDI = true;
|
||||
ToggleFeature(X86::FeatureCDI);
|
||||
}
|
||||
if (IsIntel && ((EBX >> 29) & 0x1)) {
|
||||
HasSHA = true;
|
||||
ToggleFeature(X86::FeatureSHA);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -497,6 +501,7 @@ void X86Subtarget::initializeEnvironment() {
|
||||
HasCDI = false;
|
||||
HasPFI = false;
|
||||
HasADX = false;
|
||||
HasSHA = false;
|
||||
HasPRFCHW = false;
|
||||
HasRDSEED = false;
|
||||
IsBTMemSlow = false;
|
||||
|
@ -127,6 +127,9 @@ protected:
|
||||
/// HasADX - Processor has ADX instructions.
|
||||
bool HasADX;
|
||||
|
||||
/// HasSHA - Processor has SHA instructions.
|
||||
bool HasSHA;
|
||||
|
||||
/// HasPRFCHW - Processor has PRFCHW instructions.
|
||||
bool HasPRFCHW;
|
||||
|
||||
@ -281,6 +284,7 @@ public:
|
||||
bool hasRTM() const { return HasRTM; }
|
||||
bool hasHLE() const { return HasHLE; }
|
||||
bool hasADX() const { return HasADX; }
|
||||
bool hasSHA() const { return HasSHA; }
|
||||
bool hasPRFCHW() const { return HasPRFCHW; }
|
||||
bool hasRDSEED() const { return HasRDSEED; }
|
||||
bool isBTMemSlow() const { return IsBTMemSlow; }
|
||||
|
@ -157,3 +157,9 @@
|
||||
|
||||
# CHECK: movabsq %rax, -6066930261531658096
|
||||
0x48 0xa3 0x90 0x78 0x56 0x34 0x12 0xef 0xcd 0xab
|
||||
|
||||
# CHECK: sha1rnds4 $1, %xmm1, %xmm2
|
||||
0x0f 0x3a 0xcc 0xd1 0x01
|
||||
|
||||
# CHECK: sha1rnds4 $1, (%rax), %xmm2
|
||||
0x0f 0x3a 0xcc 0x10 0x01
|
@ -120,6 +120,14 @@ movd %mm1, %edx
|
||||
// CHECK: fixup A - offset: 5, value: CPI1_0-4
|
||||
pshufb CPI1_0(%rip), %xmm1
|
||||
|
||||
// CHECK: sha1rnds4 $1, %xmm1, %xmm2
|
||||
// CHECK: encoding: [0x0f,0x3a,0xcc,0xd1,0x01]
|
||||
sha1rnds4 $1, %xmm1, %xmm2
|
||||
|
||||
// CHECK: sha1rnds4 $1, (%rax), %xmm2
|
||||
// CHECK: encoding: [0x0f,0x3a,0xcc,0x10,0x01]
|
||||
sha1rnds4 $1, (%rax), %xmm2
|
||||
|
||||
// CHECK: movq 57005(,%riz), %rbx
|
||||
// CHECK: encoding: [0x48,0x8b,0x1c,0x25,0xad,0xde,0x00,0x00]
|
||||
movq 57005(,%riz), %rbx
|
||||
|
Loading…
Reference in New Issue
Block a user