[all-commits] [llvm/llvm-project] f9e084: [LoongArch] Explicitly specify instruction properties

hev via All-commits all-commits at lists.llvm.org
Mon Jul 10 17:46:04 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f9e0845ef2f64f656e40fe84ee372590d0b8cb3b
      https://github.com/llvm/llvm-project/commit/f9e0845ef2f64f656e40fe84ee372590d0b8cb3b
  Author: Wang Rui <wangrui at loongson.cn>
  Date:   2023-07-11 (Tue, 11 Jul 2023)

  Changed paths:
    M llvm/lib/Target/LoongArch/LoongArch.td
    M llvm/lib/Target/LoongArch/LoongArchFloat32InstrInfo.td
    M llvm/lib/Target/LoongArch/LoongArchFloat64InstrInfo.td
    M llvm/lib/Target/LoongArch/LoongArchFloatInstrFormats.td
    M llvm/lib/Target/LoongArch/LoongArchInstrInfo.td
    M llvm/test/CodeGen/LoongArch/ir-instruction/atomicrmw-fp.ll
    M llvm/test/CodeGen/LoongArch/ir-instruction/fcmp-dbl.ll

  Log Message:
  -----------
  [LoongArch] Explicitly specify instruction properties

This revision explicitly specifies the machine instruction properties instead of relying on guesswork. This is because guessing instruction properties has proven to be inaccurate, such as the machine LICM not working:

```
void func(char *a, char *b)
{
    int i;

    for (i = 0; i != 72526; i++)
        a[i] = b[i];
}
```

Guessing instruction properties:

```
func:                                   # @func
        move    $a2, $zero
.LBB0_1:                                # =>This Inner Loop Header: Depth=1
        ldx.b   $a3, $a1, $a2
        stx.b   $a3, $a0, $a2
        addi.d  $a2, $a2, 1
        lu12i.w $a3, 17
        ori     $a3, $a3, 2894
        bne     $a2, $a3, .LBB0_1
        ret
.Lfunc_end0:
```

Explicitly specify instruction properties:

```
func:                                   # @func
        lu12i.w $a2, 17
        ori     $a2, $a2, 2894
        move    $a3, $zero
.LBB0_1:                                # =>This Inner Loop Header: Depth=1
        ldx.b   $a4, $a1, $a3
        stx.b   $a4, $a0, $a3
        addi.d  $a3, $a3, 1
        bne     $a3, $a2, .LBB0_1
        ret
.Lfunc_end0:
```

Reviewed By: SixWeining, xen0n

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




More information about the All-commits mailing list