Skip to content

Commit 1b58f33

Browse files
author
Hal Finkel
committed
PPC: Remove (broken) nested implicit definition lists
TableGen will not combine nested list 'let' bindings into a single list, and instead uses only the inner scope. As a result, several instruction definitions were missing implicit register defs that were in outer scopes. This de-nests these scopes and makes all instructions have only one let binding which sets implicit register definitions. llvm-svn: 179392
1 parent 2277196 commit 1b58f33

File tree

2 files changed

+153
-94
lines changed

2 files changed

+153
-94
lines changed

llvm/lib/Target/PowerPC/PPCInstr64Bit.td

Lines changed: 32 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ defm XOR8 : XForm_6r<31, 316, (outs G8RC:$rA), (ins G8RC:$rS, G8RC:$rB),
361361
[(set i64:$rA, (xor i64:$rS, i64:$rB))]>;
362362

363363
// Logical ops with immediate.
364+
let Defs = [CR0] in {
364365
def ANDIo8 : DForm_4<28, (outs G8RC:$dst), (ins G8RC:$src1, u16imm:$src2),
365366
"andi. $dst, $src1, $src2", IntGeneral,
366367
[(set i64:$dst, (and i64:$src1, immZExt16:$src2))]>,
@@ -369,6 +370,7 @@ def ANDISo8 : DForm_4<29, (outs G8RC:$dst), (ins G8RC:$src1, u16imm:$src2),
369370
"andis. $dst, $src1, $src2", IntGeneral,
370371
[(set i64:$dst, (and i64:$src1, imm16ShiftedZExt:$src2))]>,
371372
isDOT;
373+
}
372374
def ORI8 : DForm_4<24, (outs G8RC:$dst), (ins G8RC:$src1, u16imm:$src2),
373375
"ori $dst, $src1, $src2", IntSimple,
374376
[(set i64:$dst, (or i64:$src1, immZExt16:$src2))]>;
@@ -392,15 +394,14 @@ def ADD8TLS : XOForm_1<31, 266, 0, (outs G8RC:$rT), (ins G8RC:$rA, tlsreg:$rB),
392394
"add $rT, $rA, $rB@tls", IntSimple,
393395
[(set i64:$rT, (add i64:$rA, tglobaltlsaddr:$rB))]>;
394396

395-
let Defs = [CARRY] in {
396-
defm ADDC8 : XOForm_1r<31, 10, 0, (outs G8RC:$rT), (ins G8RC:$rA, G8RC:$rB),
397-
"addc", "$rT, $rA, $rB", IntGeneral,
398-
[(set i64:$rT, (addc i64:$rA, i64:$rB))]>,
399-
PPC970_DGroup_Cracked;
397+
defm ADDC8 : XOForm_1rc<31, 10, 0, (outs G8RC:$rT), (ins G8RC:$rA, G8RC:$rB),
398+
"addc", "$rT, $rA, $rB", IntGeneral,
399+
[(set i64:$rT, (addc i64:$rA, i64:$rB))]>,
400+
PPC970_DGroup_Cracked;
401+
let Defs = [CARRY] in
400402
def ADDIC8 : DForm_2<12, (outs G8RC:$rD), (ins G8RC:$rA, s16imm64:$imm),
401403
"addic $rD, $rA, $imm", IntGeneral,
402404
[(set i64:$rD, (addc i64:$rA, immSExt16:$imm))]>;
403-
}
404405
def ADDI8 : DForm_2<14, (outs G8RC:$rD), (ins G8RC_NOX0:$rA, symbolLo64:$imm),
405406
"addi $rD, $rA, $imm", IntSimple,
406407
[(set i64:$rD, (add i64:$rA, immSExt16:$imm))]>;
@@ -423,25 +424,25 @@ defm SUBF8 : XOForm_1r<31, 40, 0, (outs G8RC:$rT), (ins G8RC:$rA, G8RC:$rB),
423424
defm NEG8 : XOForm_3r<31, 104, 0, (outs G8RC:$rT), (ins G8RC:$rA),
424425
"neg", "$rT, $rA", IntSimple,
425426
[(set i64:$rT, (ineg i64:$rA))]>;
426-
let Uses = [CARRY], Defs = [CARRY] in {
427-
defm ADDE8 : XOForm_1r<31, 138, 0, (outs G8RC:$rT), (ins G8RC:$rA, G8RC:$rB),
428-
"adde", "$rT, $rA, $rB", IntGeneral,
429-
[(set i64:$rT, (adde i64:$rA, i64:$rB))]>;
430-
defm ADDME8 : XOForm_3r<31, 234, 0, (outs G8RC:$rT), (ins G8RC:$rA),
431-
"addme", "$rT, $rA", IntGeneral,
432-
[(set i64:$rT, (adde i64:$rA, -1))]>;
433-
defm ADDZE8 : XOForm_3r<31, 202, 0, (outs G8RC:$rT), (ins G8RC:$rA),
434-
"addze", "$rT, $rA", IntGeneral,
435-
[(set i64:$rT, (adde i64:$rA, 0))]>;
436-
defm SUBFE8 : XOForm_1r<31, 136, 0, (outs G8RC:$rT), (ins G8RC:$rA, G8RC:$rB),
437-
"subfe", "$rT, $rA, $rB", IntGeneral,
438-
[(set i64:$rT, (sube i64:$rB, i64:$rA))]>;
439-
defm SUBFME8 : XOForm_3r<31, 232, 0, (outs G8RC:$rT), (ins G8RC:$rA),
440-
"subfme", "$rT, $rA", IntGeneral,
441-
[(set i64:$rT, (sube -1, i64:$rA))]>;
442-
defm SUBFZE8 : XOForm_3r<31, 200, 0, (outs G8RC:$rT), (ins G8RC:$rA),
443-
"subfze", "$rT, $rA", IntGeneral,
444-
[(set i64:$rT, (sube 0, i64:$rA))]>;
427+
let Uses = [CARRY] in {
428+
defm ADDE8 : XOForm_1rc<31, 138, 0, (outs G8RC:$rT), (ins G8RC:$rA, G8RC:$rB),
429+
"adde", "$rT, $rA, $rB", IntGeneral,
430+
[(set i64:$rT, (adde i64:$rA, i64:$rB))]>;
431+
defm ADDME8 : XOForm_3rc<31, 234, 0, (outs G8RC:$rT), (ins G8RC:$rA),
432+
"addme", "$rT, $rA", IntGeneral,
433+
[(set i64:$rT, (adde i64:$rA, -1))]>;
434+
defm ADDZE8 : XOForm_3rc<31, 202, 0, (outs G8RC:$rT), (ins G8RC:$rA),
435+
"addze", "$rT, $rA", IntGeneral,
436+
[(set i64:$rT, (adde i64:$rA, 0))]>;
437+
defm SUBFE8 : XOForm_1rc<31, 136, 0, (outs G8RC:$rT), (ins G8RC:$rA, G8RC:$rB),
438+
"subfe", "$rT, $rA, $rB", IntGeneral,
439+
[(set i64:$rT, (sube i64:$rB, i64:$rA))]>;
440+
defm SUBFME8 : XOForm_3rc<31, 232, 0, (outs G8RC:$rT), (ins G8RC:$rA),
441+
"subfme", "$rT, $rA", IntGeneral,
442+
[(set i64:$rT, (sube -1, i64:$rA))]>;
443+
defm SUBFZE8 : XOForm_3rc<31, 200, 0, (outs G8RC:$rT), (ins G8RC:$rA),
444+
"subfze", "$rT, $rA", IntGeneral,
445+
[(set i64:$rT, (sube 0, i64:$rA))]>;
445446
}
446447

447448

@@ -470,11 +471,9 @@ defm SLD : XForm_6r<31, 27, (outs G8RC:$rA), (ins G8RC:$rS, GPRC:$rB),
470471
defm SRD : XForm_6r<31, 539, (outs G8RC:$rA), (ins G8RC:$rS, GPRC:$rB),
471472
"srd", "$rA, $rS, $rB", IntRotateD,
472473
[(set i64:$rA, (PPCsrl i64:$rS, i32:$rB))]>, isPPC64;
473-
let Defs = [CARRY] in {
474-
defm SRAD : XForm_6r<31, 794, (outs G8RC:$rA), (ins G8RC:$rS, GPRC:$rB),
475-
"srad", "$rA, $rS, $rB", IntRotateD,
476-
[(set i64:$rA, (PPCsra i64:$rS, i32:$rB))]>, isPPC64;
477-
}
474+
defm SRAD : XForm_6rc<31, 794, (outs G8RC:$rA), (ins G8RC:$rS, GPRC:$rB),
475+
"srad", "$rA, $rS, $rB", IntRotateD,
476+
[(set i64:$rA, (PPCsra i64:$rS, i32:$rB))]>, isPPC64;
478477

479478
let Interpretation64Bit = 1 in {
480479
defm EXTSB8 : XForm_11r<31, 954, (outs G8RC:$rA), (ins G8RC:$rS),
@@ -493,11 +492,9 @@ defm EXTSW_32_64 : XForm_11r<31, 986, (outs G8RC:$rA), (ins GPRC:$rS),
493492
"extsw", "$rA, $rS", IntSimple,
494493
[(set i64:$rA, (sext i32:$rS))]>, isPPC64;
495494

496-
let Defs = [CARRY] in {
497-
defm SRADI : XSForm_1r<31, 413, (outs G8RC:$rA), (ins G8RC:$rS, u6imm:$SH),
498-
"sradi", "$rA, $rS, $SH", IntRotateDI,
499-
[(set i64:$rA, (sra i64:$rS, (i32 imm:$SH)))]>, isPPC64;
500-
}
495+
defm SRADI : XSForm_1rc<31, 413, (outs G8RC:$rA), (ins G8RC:$rS, u6imm:$SH),
496+
"sradi", "$rA, $rS, $SH", IntRotateDI,
497+
[(set i64:$rA, (sra i64:$rS, (i32 imm:$SH)))]>, isPPC64;
501498
defm CNTLZD : XForm_11r<31, 58, (outs G8RC:$rA), (ins G8RC:$rS),
502499
"cntlzd", "$rA, $rS", IntGeneral,
503500
[(set i64:$rA, (ctlz i64:$rS))]>;

0 commit comments

Comments
 (0)