[PATCH] D87046: [PPC] Do not emit extswsli in 32BIT mode when using -mcpu=pwr9

Xiangling Liao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 18 11:59:55 PDT 2020


Xiangling_L added inline comments.


================
Comment at: llvm/lib/Target/PowerPC/PPCISelLowering.cpp:16066
       N0.getOperand(0).getValueType() != MVT::i32 ||
       CN1 == nullptr || N->getValueType(0) != MVT::i64)
     return SDValue();
----------------
It seems you can move `Subtarget.isPPC64()` here instead. Since the following code returns `SDValue()` for 32bit no matter what.


================
Comment at: llvm/test/CodeGen/PowerPC/ppc-32bit-shift.ll:10
+; RUN:     -mattr=-altivec -mcpu=pwr9 < %s | FileCheck %s --check-prefix=64BIT
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
+; RUN:     -mattr=-altivec -mcpu=pwr9 < %s | FileCheck %s --check-prefix=64BIT
----------------
The failing reason has nothing to do with endian but only related to 32bit or 64bit mode. So I am suggesting you can test `-mtriple=powerpc` and `-mtriple=powerpc64` only


================
Comment at: llvm/test/CodeGen/PowerPC/ppc-32bit-shift.ll:17
+  %add = add nsw i32 %inta, %intb
+  %conv = sext i32 %add to i64
+  %shl = shl nsw i64 %conv, 8
----------------
We can simplify the testcase like the following:
define void @a(i32 %add, i64* %sum_a) {
entry:
    %conv = sext i32 %add to i64
    %shl = shl nsw i64 %conv, 8
    store i64 %shl, i64* %sum_a, align 8
    ret void
 }


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87046/new/

https://reviews.llvm.org/D87046



More information about the llvm-commits mailing list