1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00

[mips] Store 64-bit `li.d' operand as a single 8-byte value

Now assembler generates two consecutive `.4byte` directives to store
64-bit `li.d' operand. The first directive stores high 4-byte of the
value. The second directive stores low 4-byte of the value. But on
64-bit system we load this value at once and get wrong result if the
system is little-endian.

This patch fixes the bug. It stores the `li.d' operand as a single
8-byte value.

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

llvm-svn: 374598
This commit is contained in:
Simon Atanasyan 2019-10-11 21:51:33 +00:00
parent 649e4c7138
commit 47f37ce2fc
2 changed files with 69 additions and 69 deletions

View File

@ -3433,8 +3433,8 @@ bool MipsAsmParser::expandLoadDoubleImmToGPR(MCInst &Inst, SMLoc IDLoc,
getStreamer().SwitchSection(ReadOnlySection);
getStreamer().EmitLabel(Sym, IDLoc);
getStreamer().EmitIntValue(HiImmOp64, 4);
getStreamer().EmitIntValue(LoImmOp64, 4);
getStreamer().EmitValueToAlignment(8);
getStreamer().EmitIntValue(ImmOp64, 8);
getStreamer().SwitchSection(CS);
if (emitPartialAddress(TOut, IDLoc, Sym))
@ -3519,8 +3519,8 @@ bool MipsAsmParser::expandLoadDoubleImmToFPR(MCInst &Inst, bool Is64FPU,
getStreamer().SwitchSection(ReadOnlySection);
getStreamer().EmitLabel(Sym, IDLoc);
getStreamer().EmitIntValue(HiImmOp64, 4);
getStreamer().EmitIntValue(LoImmOp64, 4);
getStreamer().EmitValueToAlignment(8);
getStreamer().EmitIntValue(ImmOp64, 8);
getStreamer().SwitchSection(CS);
if (emitPartialAddress(TOut, IDLoc, Sym))

View File

@ -17,11 +17,11 @@ li.d $4, 0.0
# N32-N64: daddiu $4, $zero, 0 # encoding: [0x00,0x00,0x04,0x64]
li.d $4, 1.12345
# ALL: .section .rodata,"a",@progbits
# ALL: [[LABEL:\$tmp[0-9]+]]:
# ALL: .4byte 1072822694
# ALL: .4byte 3037400872
# ALL: .text
# ALL: .section .rodata,"a",@progbits
# ALL-NEXT: [[LABEL:\$tmp[0-9]+]]:
# ALL-NEXT: .p2align 3
# ALL-NEXT: .8byte 4607738388174016296
# ALL-NEXT: .text
# O32-N32-NO-PIC: lui $1, %hi([[LABEL]]) # encoding: [A,A,0x01,0x3c]
# O32-N32-NO-PIC: # fixup A - offset: 0, value: %hi([[LABEL]]), kind: fixup_Mips_HI16
# O32-N32-NO-PIC: addiu $1, $1, %lo([[LABEL]]) # encoding: [A,A,0x21,0x24]
@ -61,11 +61,11 @@ li.d $4, 1.0
# N32-N64: dsll $4, $4, 46 # encoding: [0xbc,0x23,0x04,0x00]
li.d $4, 12345678910
# ALL: .section .rodata,"a",@progbits
# ALL: [[LABEL:\$tmp[0-9]+]]:
# ALL: .4byte 1107754720
# ALL: .4byte 3790602240
# ALL: .text
# ALL: .section .rodata,"a",@progbits
# ALL-NEXT: [[LABEL:\$tmp[0-9]+]]:
# ALL-NEXT: .p2align 3
# ALL-NEXT: .8byte 4757770298180239360
# ALL-NEXT: .text
# O32-N32-NO-PIC: lui $1, %hi([[LABEL]]) # encoding: [A,A,0x01,0x3c]
# O32-N32-NO-PIC: # fixup A - offset: 0, value: %hi([[LABEL]]), kind: fixup_Mips_HI16
# O32-N32-NO-PIC: addiu $1, $1, %lo([[LABEL]]) # encoding: [A,A,0x21,0x24]
@ -93,11 +93,11 @@ li.d $4, 12345678910
# N32-N64: ld $4, 0($1) # encoding: [0x00,0x00,0x24,0xdc]
li.d $4, 12345678910.0
# ALL: .section .rodata,"a",@progbits
# ALL: [[LABEL:\$tmp[0-9]+]]:
# ALL: .4byte 1107754720
# ALL: .4byte 3790602240
# ALL: .text
# ALL: .section .rodata,"a",@progbits
# ALL-NEXT: [[LABEL:\$tmp[0-9]+]]:
# ALL-NEXT: .p2align 3
# ALL-NEXT: .8byte 4757770298180239360
# ALL-NEXT: .text
# O32-N32-NO-PIC: lui $1, %hi([[LABEL]]) # encoding: [A,A,0x01,0x3c]
# O32-N32-NO-PIC: # fixup A - offset: 0, value: %hi([[LABEL]]), kind: fixup_Mips_HI16
# O32-N32-NO-PIC: addiu $1, $1, %lo([[LABEL]]) # encoding: [A,A,0x21,0x24]
@ -125,11 +125,11 @@ li.d $4, 12345678910.0
# N32-N64: ld $4, 0($1) # encoding: [0x00,0x00,0x24,0xdc]
li.d $4, 0.4
# ALL: .section .rodata,"a",@progbits
# ALL: [[LABEL:\$tmp[0-9]+]]:
# ALL: .4byte 1071225241
# ALL: .4byte 2576980378
# ALL: .text
# ALL: .section .rodata,"a",@progbits
# ALL-NEXT: [[LABEL:\$tmp[0-9]+]]:
# ALL-NEXT: .p2align 3
# ALL-NEXT: .8byte 4600877379321698714
# ALL-NEXT: .text
# O32-N32-NO-PIC: lui $1, %hi([[LABEL]]) # encoding: [A,A,0x01,0x3c]
# O32-N32-NO-PIC: # fixup A - offset: 0, value: %hi([[LABEL]]), kind: fixup_Mips_HI16
# O32-N32-NO-PIC: addiu $1, $1, %lo([[LABEL]]) # encoding: [A,A,0x21,0x24]
@ -163,11 +163,11 @@ li.d $4, 1.5
# N32-N64: dsll $4, $4, 46 # encoding: [0xbc,0x23,0x04,0x00]
li.d $4, 12345678910.12345678910
# ALL: .section .rodata,"a",@progbits
# ALL: [[LABEL:\$tmp[0-9]+]]:
# ALL: .4byte 1107754720
# ALL: .4byte 3790666967
# ALL: .text
# ALL: .section .rodata,"a",@progbits
# ALL-NEXT: [[LABEL:\$tmp[0-9]+]]:
# ALL-NEXT: .p2align 3
# ALL-NEXT: .8byte 4757770298180304087
# ALL-NEXT: .text
# O32-N32-NO-PIC: lui $1, %hi([[LABEL]]) # encoding: [A,A,0x01,0x3c]
# O32-N32-NO-PIC: # fixup A - offset: 0, value: %hi([[LABEL]]), kind: fixup_Mips_HI16
# O32-N32-NO-PIC: addiu $1, $1, %lo([[LABEL]]) # encoding: [A,A,0x21,0x24]
@ -196,11 +196,11 @@ li.d $4, 12345678910.12345678910
li.d $4, 12345678910123456789.12345678910
# ALL: .section .rodata,"a",@progbits
# ALL: [[LABEL:\$tmp[0-9]+]]:
# ALL: .4byte 1139108501
# ALL: .4byte 836738583
# ALL: .text
# ALL: .section .rodata,"a",@progbits
# ALL-NEXT: [[LABEL:\$tmp[0-9]+]]:
# ALL-NEXT: .p2align 3
# ALL-NEXT: .8byte 4892433759227321879
# ALL-NEXT: .text
# O32-N32-NO-PIC: lui $1, %hi([[LABEL]]) # encoding: [A,A,0x01,0x3c]
# O32-N32-NO-PIC: # fixup A - offset: 0, value: %hi([[LABEL]]), kind: fixup_Mips_HI16
# O32-N32-NO-PIC: addiu $1, $1, %lo([[LABEL]]) # encoding: [A,A,0x21,0x24]
@ -242,11 +242,11 @@ li.d $f4, 0.0
# N32-N64: dmtc1 $zero, $f4 # encoding: [0x00,0x20,0xa0,0x44]
li.d $f4, 1.12345
# ALL: .section .rodata,"a",@progbits
# ALL: [[LABEL:\$tmp[0-9]+]]:
# ALL: .4byte 1072822694
# ALL: .4byte 3037400872
# ALL: .text
# ALL: .section .rodata,"a",@progbits
# ALL-NEXT: [[LABEL:\$tmp[0-9]+]]:
# ALL-NEXT: .p2align 3
# ALL-NEXT: .8byte 4607738388174016296
# ALL-NEXT: .text
# O32-N32-PIC: lw $1, %got([[LABEL]])($gp) # encoding: [A,A,0x81,0x8f]
# O32-N32-PIC: # fixup A - offset: 0, value: %got([[LABEL]]), kind: fixup_Mips_GOT
# N64-PIC: ld $1, %got([[LABEL]])($gp) # encoding: [A,A,0x81,0xdf]
@ -287,11 +287,11 @@ li.d $f4, 1.0
# N32-N64: dmtc1 $1, $f4 # encoding: [0x00,0x20,0xa1,0x44]
li.d $f4, 12345678910
# ALL: .section .rodata,"a",@progbits
# ALL: [[LABEL:\$tmp[0-9]+]]:
# ALL: .4byte 1107754720
# ALL: .4byte 3790602240
# ALL: .text
# ALL: .section .rodata,"a",@progbits
# ALL-NEXT: [[LABEL:\$tmp[0-9]+]]:
# ALL-NEXT: .p2align 3
# ALL-NEXT: .8byte 4757770298180239360
# ALL-NEXT: .text
# O32-N32-PIC: lw $1, %got([[LABEL]])($gp) # encoding: [A,A,0x81,0x8f]
# O32-N32-PIC: # fixup A - offset: 0, value: %got([[LABEL]]), kind: fixup_Mips_GOT
# N64-PIC: ld $1, %got([[LABEL]])($gp) # encoding: [A,A,0x81,0xdf]
@ -310,11 +310,11 @@ li.d $f4, 12345678910
# ALL: # fixup A - offset: 0, value: %lo([[LABEL]]), kind: fixup_Mips_LO16
li.d $f4, 12345678910.0
# ALL: .section .rodata,"a",@progbits
# ALL: [[LABEL:\$tmp[0-9]+]]:
# ALL: .4byte 1107754720
# ALL: .4byte 3790602240
# ALL: .text
# ALL: .section .rodata,"a",@progbits
# ALL-NEXT: [[LABEL:\$tmp[0-9]+]]:
# ALL-NEXT: .p2align 3
# ALL-NEXT: .8byte 4757770298180239360
# ALL-NEXT: .text
# O32-N32-PIC: lw $1, %got([[LABEL]])($gp) # encoding: [A,A,0x81,0x8f]
# O32-N32-PIC: # fixup A - offset: 0, value: %got([[LABEL]]), kind: fixup_Mips_GOT
# N64-PIC: ld $1, %got([[LABEL]])($gp) # encoding: [A,A,0x81,0xdf]
@ -333,11 +333,11 @@ li.d $f4, 12345678910.0
# ALL: # fixup A - offset: 0, value: %lo([[LABEL]]), kind: fixup_Mips_LO16
li.d $f4, 0.4
# ALL: .section .rodata,"a",@progbits
# ALL: [[LABEL:\$tmp[0-9]+]]:
# ALL: .4byte 1071225241
# ALL: .4byte 2576980378
# ALL: .text
# ALL: .section .rodata,"a",@progbits
# ALL-NEXT: [[LABEL:\$tmp[0-9]+]]:
# ALL-NEXT: .p2align 3
# ALL-NEXT: .8byte 4600877379321698714
# ALL-NEXT: .text
# O32-N32-PIC: lw $1, %got([[LABEL]])($gp) # encoding: [A,A,0x81,0x8f]
# O32-N32-PIC: # fixup A - offset: 0, value: %got([[LABEL]]), kind: fixup_Mips_GOT
# N64-PIC: ld $1, %got([[LABEL]])($gp) # encoding: [A,A,0x81,0xdf]
@ -378,11 +378,11 @@ li.d $f4, 2.5
# N32-N64: dmtc1 $1, $f4 # encoding: [0x00,0x20,0xa1,0x44]
li.d $f4, 2.515625
# ALL: .section .rodata,"a",@progbits
# ALL: [[LABEL:\$tmp[0-9]+]]:
# ALL: .4byte 1074012160
# ALL: .4byte 0
# ALL: .text
# ALL: .section .rodata,"a",@progbits
# ALL-NEXT: [[LABEL:\$tmp[0-9]+]]:
# ALL-NEXT: .p2align 3
# ALL-NEXT: .8byte 4612847102706319360
# ALL-NEXT: .text
# O32-N32-PIC: lw $1, %got([[LABEL]])($gp) # encoding: [A,A,0x81,0x8f]
# O32-N32-PIC: # fixup A - offset: 0, value: %got([[LABEL]]), kind: fixup_Mips_GOT
# N64-PIC: ld $1, %got([[LABEL]])($gp) # encoding: [A,A,0x81,0xdf]
@ -401,11 +401,11 @@ li.d $f4, 2.515625
# ALL: # fixup A - offset: 0, value: %lo([[LABEL]]), kind: fixup_Mips_LO16
li.d $f4, 12345678910.12345678910
# ALL: .section .rodata,"a",@progbits
# ALL: [[LABEL:\$tmp[0-9]+]]:
# ALL: .4byte 1107754720
# ALL: .4byte 3790666967
# ALL: .text
# ALL: .section .rodata,"a",@progbits
# ALL-NEXT: [[LABEL:\$tmp[0-9]+]]:
# ALL-NEXT: .p2align 3
# ALL-NEXT: .8byte 4757770298180304087
# ALL-NEXT: .text
# O32-N32-PIC: lw $1, %got([[LABEL]])($gp) # encoding: [A,A,0x81,0x8f]
# O32-N32-PIC: # fixup A - offset: 0, value: %got([[LABEL]]), kind: fixup_Mips_GOT
# N64-PIC: ld $1, %got([[LABEL]])($gp) # encoding: [A,A,0x81,0xdf]
@ -424,11 +424,11 @@ li.d $f4, 12345678910.12345678910
# ALL: # fixup A - offset: 0, value: %lo([[LABEL]]), kind: fixup_Mips_LO16
li.d $f4, 12345678910123456789.12345678910
# ALL: .section .rodata,"a",@progbits
# ALL: [[LABEL:\$tmp[0-9]+]]:
# ALL: .4byte 1139108501
# ALL: .4byte 836738583
# ALL: .text
# ALL: .section .rodata,"a",@progbits
# ALL-NEXT: [[LABEL:\$tmp[0-9]+]]:
# ALL-NEXT: .p2align 3
# ALL-NEXT: .8byte 4892433759227321879
# ALL-NEXT: .text
# O32-N32-PIC: lw $1, %got([[LABEL]])($gp) # encoding: [A,A,0x81,0x8f]
# O32-N32-PIC: # fixup A - offset: 0, value: %got([[LABEL]]), kind: fixup_Mips_GOT
# N64-PIC: ld $1, %got([[LABEL]])($gp) # encoding: [A,A,0x81,0xdf]