Skip to content

Commit

Permalink
[PowerPC][Altivec] Add mfvrd and mffprd extended mnemonic
Browse files Browse the repository at this point in the history
mfvrd and mffprd are both alias to mfvrsd.
This patch enables correct parsing of the aliases, but we still emit a mfvrsd.

Committing on behalf of brunoalr (Bruno Rosa).

Differential Revision: https://reviews.llvm.org/D29177


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297849 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
nemanjai committed Mar 15, 2017
1 parent 4160d49 commit 245bc88
Show file tree
Hide file tree
Showing 7 changed files with 195 additions and 453 deletions.
12 changes: 12 additions & 0 deletions lib/Target/PowerPC/PPCInstrVSX.td
Original file line number Diff line number Diff line change
Expand Up @@ -1410,6 +1410,11 @@ let Predicates = [HasDirectMove] in {
"mfvsrd $rA, $XT", IIC_VecGeneral,
[(set i64:$rA, (PPCmfvsr f64:$XT))]>,
Requires<[In64BitMode]>;
let isCodeGenOnly = 1 in
def MFVRD : XX1_RS6_RD5_XO<31, 51, (outs g8rc:$rA), (ins vrrc:$XT),
"mfvsrd $rA, $XT", IIC_VecGeneral,
[]>,
Requires<[In64BitMode]>;
def MFVSRWZ : XX1_RS6_RD5_XO<31, 115, (outs gprc:$rA), (ins vsfrc:$XT),
"mfvsrwz $rA, $XT", IIC_VecGeneral,
[(set i32:$rA, (PPCmfvsr f64:$XT))]>;
Expand Down Expand Up @@ -1440,6 +1445,13 @@ let Predicates = [IsISA3_0, HasDirectMove] in {
} // IsISA3_0, HasDirectMove
} // UseVSXReg = 1

// We want to parse this from asm, but we don't want to emit this as it would
// be emitted with a VSX reg. So leave Emit = 0 here.
def : InstAlias<"mfvrd $rA, $XT",
(MFVRD g8rc:$rA, vrrc:$XT), 0>;
def : InstAlias<"mffprd $rA, $src",
(MFVSRD g8rc:$rA, f8rc:$src)>;

/* Direct moves of various widths from GPR's into VSR's. Each move lines
the value up into element 0 (both BE and LE). Namely, entities smaller than
a doubleword are shifted left and moved for BE. For LE, they're moved, then
Expand Down
4 changes: 2 additions & 2 deletions test/CodeGen/PowerPC/bitcasts-direct-move.ll
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ entry:
ret i64 %0
; CHECK-P7: stxsdx 1,
; CHECK-P7: ld 3,
; CHECK: mfvsrd 3, 1
; CHECK: mffprd 3, 1
}

define float @i32tof32(i32 signext %a) {
Expand Down Expand Up @@ -60,7 +60,7 @@ entry:
ret i64 %0
; CHECK-P7: stxsdx 1,
; CHECK-P7: ld 3,
; CHECK: mfvsrd 3, 1
; CHECK: mffprd 3, 1
}

define float @i32utof32(i32 zeroext %a) {
Expand Down
8 changes: 4 additions & 4 deletions test/CodeGen/PowerPC/fp-int-conversions-direct-moves.ll
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ entry:
ret i64 %conv
; CHECK-LABEL: @_Z7testllff
; CHECK: xscvdpsxds [[CONVREG13:[0-9]+]], 1
; CHECK: mfvsrd 3, [[CONVREG13]]
; CHECK: mffprd 3, [[CONVREG13]]
}

; Function Attrs: nounwind
Expand All @@ -349,7 +349,7 @@ entry:
ret i64 %conv
; CHECK-LABEL: @_Z7testlldd
; CHECK: xscvdpsxds [[CONVREG14:[0-9]+]], 1
; CHECK: mfvsrd 3, [[CONVREG14]]
; CHECK: mffprd 3, [[CONVREG14]]
}

; Function Attrs: nounwind
Expand All @@ -375,7 +375,7 @@ entry:
ret i64 %conv
; CHECK-LABEL: @_Z8testullff
; CHECK: xscvdpuxds [[CONVREG15:[0-9]+]], 1
; CHECK: mfvsrd 3, [[CONVREG15]]
; CHECK: mffprd 3, [[CONVREG15]]
}

; Function Attrs: nounwind
Expand All @@ -401,7 +401,7 @@ entry:
ret i64 %conv
; CHECK-LABEL: @_Z8testulldd
; CHECK: xscvdpuxds [[CONVREG16:[0-9]+]], 1
; CHECK: mfvsrd 3, [[CONVREG16]]
; CHECK: mffprd 3, [[CONVREG16]]
}

; Function Attrs: nounwind
Expand Down
10 changes: 5 additions & 5 deletions test/CodeGen/PowerPC/fp128-bitcast-after-operation.ll
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ entry:
; PPC64: blr

; PPC64-P8-LABEL: test_abs:
; PPC64-P8-DAG: mfvsrd [[LO:[0-9]+]], 2
; PPC64-P8-DAG: mfvsrd [[HI:[0-9]+]], 1
; PPC64-P8-DAG: mffprd [[LO:[0-9]+]], 2
; PPC64-P8-DAG: mffprd [[HI:[0-9]+]], 1
; PPC64-P8-DAG: rldicr [[FLIP_BIT:[0-9]+]], [[HI]], 0, 0
; PPC64-P8-DAG: xor 3, [[HI]], [[FLIP_BIT]]
; PPC64-P8-DAG: xor 4, [[LO]], [[FLIP_BIT]]
Expand Down Expand Up @@ -59,8 +59,8 @@ entry:
; PPC64: blr

; PPC64-P8-LABEL: test_neg:
; PPC64-P8-DAG: mfvsrd [[LO:[0-9]+]], 2
; PPC64-P8-DAG: mfvsrd [[HI:[0-9]+]], 1
; PPC64-P8-DAG: mffprd [[LO:[0-9]+]], 2
; PPC64-P8-DAG: mffprd [[HI:[0-9]+]], 1
; PPC64-P8-DAG: li [[IMM1:[0-9]+]], 1
; PPC64-P8-DAG: sldi [[FLIP_BIT:[0-9]+]], [[IMM1]], 63
; PPC64-P8-NOT: BARRIER
Expand Down Expand Up @@ -101,7 +101,7 @@ entry:
; PPC64: blr

; PPC64-P8-LABEL: test_copysign:
; PPC64-P8-DAG: mfvsrd [[X_HI:[0-9]+]], 1
; PPC64-P8-DAG: mffprd [[X_HI:[0-9]+]], 1
; PPC64-P8-DAG: li [[HI_TMP:[0-9]+]], 16399
; PPC64-P8-DAG: sldi [[CST_HI:[0-9]+]], [[HI_TMP]], 48
; PPC64-P8-DAG: li [[LO_TMP:[0-9]+]], 3019
Expand Down
Loading

0 comments on commit 245bc88

Please sign in to comment.