[mips] Use less instruction to load zero into FPR by li.s / li.d pseudos

If `li.s` or `li.d` loads zero into a FPR, it's not necessary to load
zero into `at` GPR register and then move its value into a floating
point register. We can use as a source register the `zero / $0` one.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374597 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Simon Atanasyan
2019-10-11 21:51:23 +00:00
parent 8eb69f732f
commit a7f4c4e9f4
3 changed files with 26 additions and 29 deletions
+6 -12
View File
@@ -228,24 +228,18 @@ li.d $4, 12345678910123456789.12345678910
# N32-N64: ld $4, 0($1) # encoding: [0x00,0x00,0x24,0xdc]
li.d $f4, 0
# O32: addiu $1, $zero, 0 # encoding: [0x00,0x00,0x01,0x24]
# O32: mtc1 $1, $f5 # encoding: [0x00,0x28,0x81,0x44]
# O32: mtc1 $zero, $f5 # encoding: [0x00,0x28,0x80,0x44]
# O32: mtc1 $zero, $f4 # encoding: [0x00,0x20,0x80,0x44]
# CHECK-MIPS32r2: addiu $1, $zero, 0 # encoding: [0x00,0x00,0x01,0x24]
# CHECK-MIPS32r2: mtc1 $zero, $f4 # encoding: [0x00,0x20,0x80,0x44]
# CHECK-MIPS32r2: mthc1 $1, $f4 # encoding: [0x00,0x20,0xe1,0x44]
# N32-N64: addiu $1, $zero, 0 # encoding: [0x00,0x00,0x01,0x24]
# N32-N64: dmtc1 $1, $f4 # encoding: [0x00,0x20,0xa1,0x44]
# CHECK-MIPS32r2: mthc1 $zero, $f4 # encoding: [0x00,0x20,0xe0,0x44]
# N32-N64: dmtc1 $zero, $f4 # encoding: [0x00,0x20,0xa0,0x44]
li.d $f4, 0.0
# O32: addiu $1, $zero, 0 # encoding: [0x00,0x00,0x01,0x24]
# O32: mtc1 $1, $f5 # encoding: [0x00,0x28,0x81,0x44]
# O32: mtc1 $zero, $f5 # encoding: [0x00,0x28,0x80,0x44]
# O32: mtc1 $zero, $f4 # encoding: [0x00,0x20,0x80,0x44]
# CHECK-MIPS32r2: addiu $1, $zero, 0 # encoding: [0x00,0x00,0x01,0x24]
# CHECK-MIPS32r2: mtc1 $zero, $f4 # encoding: [0x00,0x20,0x80,0x44]
# CHECK-MIPS32r2: mthc1 $1, $f4 # encoding: [0x00,0x20,0xe1,0x44]
# N32-N64: addiu $1, $zero, 0 # encoding: [0x00,0x00,0x01,0x24]
# N32-N64: dmtc1 $1, $f4 # encoding: [0x00,0x20,0xa1,0x44]
# CHECK-MIPS32r2: mthc1 $zero, $f4 # encoding: [0x00,0x20,0xe0,0x44]
# N32-N64: dmtc1 $zero, $f4 # encoding: [0x00,0x20,0xa0,0x44]
li.d $f4, 1.12345
# ALL: .section .rodata,"a",@progbits
+2 -4
View File
@@ -45,12 +45,10 @@ li.s $4, 12345678910123456789.12345678910
# ALL: ori $4, $4, 21674 # encoding: [0xaa,0x54,0x84,0x34]
li.s $f4, 0
# ALL: addiu $1, $zero, 0 # encoding: [0x00,0x00,0x01,0x24]
# ALL: mtc1 $1, $f4 # encoding: [0x00,0x20,0x81,0x44]
# ALL: mtc1 $zero, $f4 # encoding: [0x00,0x20,0x80,0x44]
li.s $f4, 0.0
# ALL: addiu $1, $zero, 0 # encoding: [0x00,0x00,0x01,0x24]
# ALL: mtc1 $1, $f4 # encoding: [0x00,0x20,0x81,0x44]
# ALL: mtc1 $zero, $f4 # encoding: [0x00,0x20,0x80,0x44]
li.s $f4, 1.12345
# ALL: .section .rodata,"a",@progbits