[PATCH] D83500: [PowerPC][Power10] Implement custom codegen for the vec_replace_elt and vec_replace_unaligned builtins.

Amy Kwan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 9 11:55:13 PDT 2020


amyk created this revision.
amyk added reviewers: PowerPC, power-llvm-team, nemanjai, lei.
amyk added projects: LLVM, PowerPC, clang.
Herald added a subscriber: shchenz.

This patch implements custom codegen for the `vec_replace_elt` and `vec_replace_unaligned` builtins.

These builtins map to the `@llvm.ppc.altivec.vinsw` and `@llvm.ppc.altivec.vinsd` intrinsics depending on the arguments.
The main motivation for doing custom codegen for these intrinsics is because there are float and double versions of the
builtin. Normally, the converting the float to an integer would be done via `fptoui` in the IR, however it is more preferable to
use `bitcast`.

The original patch that implemented the front end done this adding unions to altivec.h (https://reviews.llvm.org/D82359) but
this patch uses custom codegen to use `bitcast` instead for the float conversion instead.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83500

Files:
  clang/include/clang/Basic/BuiltinsPPC.def
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Headers/altivec.h
  clang/test/CodeGen/builtins-ppc-p10vector.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83500.276794.patch
Type: text/x-patch
Size: 12113 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200709/27733ea3/attachment.bin>


More information about the llvm-commits mailing list