[PATCH] D158487: [PowerPC][altivec] Optimize codegen of vec_promote

Kai Luo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 22 01:50:46 PDT 2023


lkail added inline comments.


================
Comment at: clang/lib/Headers/altivec.h:14662
+  vector unsigned char __res =
+      __builtin_shufflevector(__zero, __zero, -1, -1, -1, -1, -1, -1, -1, -1,
+                              -1, -1, -1, -1, -1, -1, -1, -1);
----------------
qiucf wrote:
> Could we just define it without initialization? This can also make undefined vector.
Using `__builtin_shufflevector` generates poison values, which is stronger than `undef`, exposing more optimizations in my view. See https://llvm.org/docs/LangRef.html#id1781.


================
Comment at: llvm/test/CodeGen/PowerPC/vec-promote.ll:1
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
+; RUN: llc -mtriple=powerpc64-unknown-unknown -verify-machineinstrs -mcpu=pwr8 \
----------------
qiucf wrote:
> We don't need this file because (1) no backend codegen changed; (2) further changes to `altivec.h` will not change this file.
I prefer keeping this file
1. Backend lacks vec_promote equivalent tests.
2. to show different codegen of FE exposes different optimization opportunities to backend which is the core value of this patch. Codegen quality should be finally reflected by assembly.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158487



More information about the llvm-commits mailing list