OSDN Git Service

[PowerPC] better instruction selection for OR (XOR) with a 32-bit immediate
authorHiroshi Inoue <inouehrs@jp.ibm.com>
Wed, 23 Aug 2017 08:55:18 +0000 (08:55 +0000)
committerHiroshi Inoue <inouehrs@jp.ibm.com>
Wed, 23 Aug 2017 08:55:18 +0000 (08:55 +0000)
commitea638e645f3e3e9f8c72553391d3867d8645b771
treeb5cbce170a30f12f95184354eb2f5f3cf79bf924
parentd753d9e1b82d8c31cee2c9287b971082b9d42f9c
[PowerPC] better instruction selection for OR (XOR) with a 32-bit immediate

- recommitting after fixing a test failure on MacOS

On PPC64, OR (XOR) with a 32-bit immediate can be done with only two instructions, i.e. ori + oris.
But the current LLVM generates three or four instructions for this purpose (and also it clobbers one GPR).

This patch makes PPC backend generate ori + oris (xori + xoris) for OR (XOR) with a 32-bit immediate.

e.g. (x | 0xFFFFFFFF) should be

ori 3, 3, 65535
oris 3, 3, 65535

but LLVM generates without this patch

li 4, 0
oris 4, 4, 65535
ori 4, 4, 65535
or 3, 3, 4

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311538 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/PowerPC/PPCISelDAGToDAG.cpp
test/CodeGen/PowerPC/ori_imm32.ll [new file with mode: 0644]