[Power10] Implement custom codegen for the vec_replace_elt and vec_replace_unaligned...
authorAmy Kwan <amy.kwan1@ibm.com>
Wed, 23 Sep 2020 22:14:24 +0000 (17:14 -0500)
committerAmy Kwan <amy.kwan1@ibm.com>
Thu, 24 Sep 2020 03:55:25 +0000 (22:55 -0500)
commit6b136b19cbe4e96adea63b75f1f2f76ec25c708e
tree00b49e4cd8108b8c98c0396753817415b80e1c7d
parentd1aa143aa84e20a8cdef24a0b5ccf70941884534
[Power10]  Implement custom codegen for the vec_replace_elt and vec_replace_unaligned builtins.

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. This is incorrect as fptoui truncates the value and we must
ensure the value is not truncated. Therefore, we provide custom codegen to utilize
bitcast instead as bitcasts do not truncate.

Differential Revision: https://reviews.llvm.org/D83500
clang/include/clang/Basic/BuiltinsPPC.def
clang/lib/CodeGen/CGBuiltin.cpp
clang/lib/Headers/altivec.h
clang/lib/Sema/SemaChecking.cpp
clang/test/CodeGen/builtins-ppc-p10vector.c
clang/test/CodeGen/builtins-ppc-vec-ins-error.c [new file with mode: 0644]