[PATCH] D154192: [LoongArch] Explicitly specify instruction properties

hev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 30 02:11:05 PDT 2023


hev created this revision.
hev added reviewers: SixWeining, wangleiat, xen0n, xry111, gonglingqin.
hev added a project: LLVM.
Herald added a subscriber: hiraditya.
Herald added a project: All.
hev requested review of this revision.
Herald added a subscriber: llvm-commits.

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
  # %bb.0:
          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
  # %bb.2:
          ret
  .Lfunc_end0:

Explicitly specify instruction properties:

  func:                                   # @func
  # %bb.0:
          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
  # %bb.2:
          ret
  .Lfunc_end0:


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154192

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154192.536146.patch
Type: text/x-patch
Size: 32544 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230630/29062843/attachment.bin>


More information about the llvm-commits mailing list