mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-01 15:11:24 +00:00
[X86] Factor out the CMOV pseudo definitions. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229206 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
821ec14add
commit
6a50342499
@ -475,59 +475,50 @@ def TLSCall_64 : I<0, Pseudo, (outs), (ins i64mem:$sym),
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Conditional Move Pseudo Instructions
|
||||
|
||||
// X86 doesn't have 8-bit conditional moves. Use a customInserter to
|
||||
// emit control flow. An alternative to this is to mark i8 SELECT as Promote,
|
||||
// however that requires promoting the operands, and can induce additional
|
||||
// i8 register pressure.
|
||||
// CMOV* - Used to implement the SELECT DAG operation. Expanded after
|
||||
// instruction selection into a branch sequence.
|
||||
multiclass CMOVrr_PSEUDO<RegisterClass RC, ValueType VT> {
|
||||
def CMOV#NAME : I<0, Pseudo,
|
||||
(outs RC:$dst), (ins RC:$t, RC:$f, i8imm:$cond),
|
||||
"#CMOV_"#NAME#" PSEUDO!",
|
||||
[(set RC:$dst, (VT (X86cmov RC:$t, RC:$f, imm:$cond,
|
||||
EFLAGS)))]>;
|
||||
}
|
||||
|
||||
let usesCustomInserter = 1, Uses = [EFLAGS] in {
|
||||
def CMOV_GR8 : I<0, Pseudo,
|
||||
(outs GR8:$dst), (ins GR8:$src1, GR8:$src2, i8imm:$cond),
|
||||
"#CMOV_GR8 PSEUDO!",
|
||||
[(set GR8:$dst, (X86cmov GR8:$src1, GR8:$src2,
|
||||
imm:$cond, EFLAGS))]>;
|
||||
// X86 doesn't have 8-bit conditional moves. Use a customInserter to
|
||||
// emit control flow. An alternative to this is to mark i8 SELECT as Promote,
|
||||
// however that requires promoting the operands, and can induce additional
|
||||
// i8 register pressure.
|
||||
defm _GR8 : CMOVrr_PSEUDO<GR8, i8>;
|
||||
|
||||
let Predicates = [NoCMov] in {
|
||||
def CMOV_GR32 : I<0, Pseudo,
|
||||
(outs GR32:$dst), (ins GR32:$src1, GR32:$src2, i8imm:$cond),
|
||||
"#CMOV_GR32* PSEUDO!",
|
||||
[(set GR32:$dst,
|
||||
(X86cmov GR32:$src1, GR32:$src2, imm:$cond, EFLAGS))]>;
|
||||
def CMOV_GR16 : I<0, Pseudo,
|
||||
(outs GR16:$dst), (ins GR16:$src1, GR16:$src2, i8imm:$cond),
|
||||
"#CMOV_GR16* PSEUDO!",
|
||||
[(set GR16:$dst,
|
||||
(X86cmov GR16:$src1, GR16:$src2, imm:$cond, EFLAGS))]>;
|
||||
} // Predicates = [NoCMov]
|
||||
let Predicates = [NoCMov] in {
|
||||
defm _GR32 : CMOVrr_PSEUDO<GR32, i32>;
|
||||
defm _GR16 : CMOVrr_PSEUDO<GR16, i16>;
|
||||
} // Predicates = [NoCMov]
|
||||
|
||||
// fcmov doesn't handle all possible EFLAGS, provide a fallback if there is no
|
||||
// SSE1.
|
||||
let Predicates = [FPStackf32] in
|
||||
def CMOV_RFP32 : I<0, Pseudo,
|
||||
(outs RFP32:$dst),
|
||||
(ins RFP32:$src1, RFP32:$src2, i8imm:$cond),
|
||||
"#CMOV_RFP32 PSEUDO!",
|
||||
[(set RFP32:$dst,
|
||||
(X86cmov RFP32:$src1, RFP32:$src2, imm:$cond,
|
||||
EFLAGS))]>;
|
||||
// fcmov doesn't handle all possible EFLAGS, provide a fallback if there is no
|
||||
// SSE2.
|
||||
let Predicates = [FPStackf64] in
|
||||
def CMOV_RFP64 : I<0, Pseudo,
|
||||
(outs RFP64:$dst),
|
||||
(ins RFP64:$src1, RFP64:$src2, i8imm:$cond),
|
||||
"#CMOV_RFP64 PSEUDO!",
|
||||
[(set RFP64:$dst,
|
||||
(X86cmov RFP64:$src1, RFP64:$src2, imm:$cond,
|
||||
EFLAGS))]>;
|
||||
def CMOV_RFP80 : I<0, Pseudo,
|
||||
(outs RFP80:$dst),
|
||||
(ins RFP80:$src1, RFP80:$src2, i8imm:$cond),
|
||||
"#CMOV_RFP80 PSEUDO!",
|
||||
[(set RFP80:$dst,
|
||||
(X86cmov RFP80:$src1, RFP80:$src2, imm:$cond,
|
||||
EFLAGS))]>;
|
||||
} // UsesCustomInserter = 1, Uses = [EFLAGS]
|
||||
// fcmov doesn't handle all possible EFLAGS, provide a fallback if there is no
|
||||
// SSE1/SSE2.
|
||||
let Predicates = [FPStackf32] in
|
||||
defm _RFP32 : CMOVrr_PSEUDO<RFP32, f32>;
|
||||
|
||||
let Predicates = [FPStackf64] in
|
||||
defm _RFP64 : CMOVrr_PSEUDO<RFP64, f64>;
|
||||
|
||||
defm _RFP80 : CMOVrr_PSEUDO<RFP80, f80>;
|
||||
|
||||
defm _FR32 : CMOVrr_PSEUDO<FR32, f32>;
|
||||
defm _FR64 : CMOVrr_PSEUDO<FR64, f64>;
|
||||
defm _V4F32 : CMOVrr_PSEUDO<VR128, v4f32>;
|
||||
defm _V2F64 : CMOVrr_PSEUDO<VR128, v2f64>;
|
||||
defm _V2I64 : CMOVrr_PSEUDO<VR128, v2i64>;
|
||||
defm _V8F32 : CMOVrr_PSEUDO<VR256, v8f32>;
|
||||
defm _V4F64 : CMOVrr_PSEUDO<VR256, v4f64>;
|
||||
defm _V4I64 : CMOVrr_PSEUDO<VR256, v4i64>;
|
||||
defm _V8I64 : CMOVrr_PSEUDO<VR512, v8i64>;
|
||||
defm _V8F64 : CMOVrr_PSEUDO<VR512, v8f64>;
|
||||
defm _V16F32 : CMOVrr_PSEUDO<VR512, v16f32>;
|
||||
} // usesCustomInserter = 1, Uses = [EFLAGS]
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Normal-Instructions-With-Lock-Prefix Pseudo Instructions
|
||||
@ -863,79 +854,6 @@ def ACQUIRE_MOV32rm : I<0, Pseudo, (outs GR32:$dst), (ins i32mem:$src),
|
||||
def ACQUIRE_MOV64rm : I<0, Pseudo, (outs GR64:$dst), (ins i64mem:$src),
|
||||
"#ACQUIRE_MOV PSEUDO!",
|
||||
[(set GR64:$dst, (atomic_load_64 addr:$src))]>;
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Conditional Move Pseudo Instructions.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// CMOV* - Used to implement the SSE SELECT DAG operation. Expanded after
|
||||
// instruction selection into a branch sequence.
|
||||
let Uses = [EFLAGS], usesCustomInserter = 1 in {
|
||||
def CMOV_FR32 : I<0, Pseudo,
|
||||
(outs FR32:$dst), (ins FR32:$t, FR32:$f, i8imm:$cond),
|
||||
"#CMOV_FR32 PSEUDO!",
|
||||
[(set FR32:$dst, (X86cmov FR32:$t, FR32:$f, imm:$cond,
|
||||
EFLAGS))]>;
|
||||
def CMOV_FR64 : I<0, Pseudo,
|
||||
(outs FR64:$dst), (ins FR64:$t, FR64:$f, i8imm:$cond),
|
||||
"#CMOV_FR64 PSEUDO!",
|
||||
[(set FR64:$dst, (X86cmov FR64:$t, FR64:$f, imm:$cond,
|
||||
EFLAGS))]>;
|
||||
def CMOV_V4F32 : I<0, Pseudo,
|
||||
(outs VR128:$dst), (ins VR128:$t, VR128:$f, i8imm:$cond),
|
||||
"#CMOV_V4F32 PSEUDO!",
|
||||
[(set VR128:$dst,
|
||||
(v4f32 (X86cmov VR128:$t, VR128:$f, imm:$cond,
|
||||
EFLAGS)))]>;
|
||||
def CMOV_V2F64 : I<0, Pseudo,
|
||||
(outs VR128:$dst), (ins VR128:$t, VR128:$f, i8imm:$cond),
|
||||
"#CMOV_V2F64 PSEUDO!",
|
||||
[(set VR128:$dst,
|
||||
(v2f64 (X86cmov VR128:$t, VR128:$f, imm:$cond,
|
||||
EFLAGS)))]>;
|
||||
def CMOV_V2I64 : I<0, Pseudo,
|
||||
(outs VR128:$dst), (ins VR128:$t, VR128:$f, i8imm:$cond),
|
||||
"#CMOV_V2I64 PSEUDO!",
|
||||
[(set VR128:$dst,
|
||||
(v2i64 (X86cmov VR128:$t, VR128:$f, imm:$cond,
|
||||
EFLAGS)))]>;
|
||||
def CMOV_V8F32 : I<0, Pseudo,
|
||||
(outs VR256:$dst), (ins VR256:$t, VR256:$f, i8imm:$cond),
|
||||
"#CMOV_V8F32 PSEUDO!",
|
||||
[(set VR256:$dst,
|
||||
(v8f32 (X86cmov VR256:$t, VR256:$f, imm:$cond,
|
||||
EFLAGS)))]>;
|
||||
def CMOV_V4F64 : I<0, Pseudo,
|
||||
(outs VR256:$dst), (ins VR256:$t, VR256:$f, i8imm:$cond),
|
||||
"#CMOV_V4F64 PSEUDO!",
|
||||
[(set VR256:$dst,
|
||||
(v4f64 (X86cmov VR256:$t, VR256:$f, imm:$cond,
|
||||
EFLAGS)))]>;
|
||||
def CMOV_V4I64 : I<0, Pseudo,
|
||||
(outs VR256:$dst), (ins VR256:$t, VR256:$f, i8imm:$cond),
|
||||
"#CMOV_V4I64 PSEUDO!",
|
||||
[(set VR256:$dst,
|
||||
(v4i64 (X86cmov VR256:$t, VR256:$f, imm:$cond,
|
||||
EFLAGS)))]>;
|
||||
def CMOV_V8I64 : I<0, Pseudo,
|
||||
(outs VR512:$dst), (ins VR512:$t, VR512:$f, i8imm:$cond),
|
||||
"#CMOV_V8I64 PSEUDO!",
|
||||
[(set VR512:$dst,
|
||||
(v8i64 (X86cmov VR512:$t, VR512:$f, imm:$cond,
|
||||
EFLAGS)))]>;
|
||||
def CMOV_V8F64 : I<0, Pseudo,
|
||||
(outs VR512:$dst), (ins VR512:$t, VR512:$f, i8imm:$cond),
|
||||
"#CMOV_V8F64 PSEUDO!",
|
||||
[(set VR512:$dst,
|
||||
(v8f64 (X86cmov VR512:$t, VR512:$f, imm:$cond,
|
||||
EFLAGS)))]>;
|
||||
def CMOV_V16F32 : I<0, Pseudo,
|
||||
(outs VR512:$dst), (ins VR512:$t, VR512:$f, i8imm:$cond),
|
||||
"#CMOV_V16F32 PSEUDO!",
|
||||
[(set VR512:$dst,
|
||||
(v16f32 (X86cmov VR512:$t, VR512:$f, imm:$cond,
|
||||
EFLAGS)))]>;
|
||||
}
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// DAG Pattern Matching Rules
|
||||
|
Loading…
Reference in New Issue
Block a user