[all-commits] [llvm/llvm-project] 4c7f82: Update @llvm.powi to handle different int sizes fo...
Björn Pettersson via All-commits
all-commits at lists.llvm.org
Thu Jun 17 00:39:24 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 4c7f820b2b206bb7b4e32e575a78316701471203
https://github.com/llvm/llvm-project/commit/4c7f820b2b206bb7b4e32e575a78316701471203
Author: Bjorn Pettersson <bjorn.a.pettersson at ericsson.com>
Date: 2021-06-17 (Thu, 17 Jun 2021)
Changed paths:
M clang/lib/CodeGen/CGBuiltin.cpp
M clang/test/CodeGen/avr-builtins.c
M clang/test/CodeGen/math-builtins.c
A clang/test/CodeGen/msp430-builtins.c
M llvm/docs/LangRef.rst
M llvm/include/llvm/Analysis/VectorUtils.h
M llvm/include/llvm/CodeGen/ISDOpcodes.h
M llvm/include/llvm/IR/Intrinsics.td
M llvm/lib/Analysis/VectorUtils.cpp
M llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
M llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
M llvm/lib/Target/Mips/Mips16HardFloat.cpp
M llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
M llvm/lib/Transforms/Scalar/Scalarizer.cpp
M llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
M llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
M llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
M llvm/test/Analysis/CostModel/AArch64/sve-intrinsics.ll
A llvm/test/Bitcode/upgrade-powi-intrinsics.ll
A llvm/test/Bitcode/upgrade-powi-intrinsics.ll.bc
M llvm/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
M llvm/test/CodeGen/AArch64/arm64-vfloatintrinsics.ll
M llvm/test/CodeGen/AArch64/f16-instructions.ll
M llvm/test/CodeGen/AArch64/illegal-float-ops.ll
M llvm/test/CodeGen/AArch64/powi-windows.ll
M llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.powi.ll
M llvm/test/CodeGen/AMDGPU/llvm.powi.ll
M llvm/test/CodeGen/ARM/2011-11-29-128bitArithmetics.ll
M llvm/test/CodeGen/ARM/Windows/powi.ll
M llvm/test/CodeGen/ARM/fp16-fullfp16.ll
M llvm/test/CodeGen/ARM/fp16-promote.ll
M llvm/test/CodeGen/ARM/fpowi.ll
M llvm/test/CodeGen/ARM/vfloatintrinsics.ll
M llvm/test/CodeGen/Generic/fpowi-promote.ll
M llvm/test/CodeGen/Generic/replace-intrinsics-with-veclib.ll
M llvm/test/CodeGen/Mips/mips64-f128.ll
M llvm/test/CodeGen/Mips/msa/f16-llvm-ir.ll
M llvm/test/CodeGen/Mips/powif64_16.ll
M llvm/test/CodeGen/Mips/pr36061.ll
M llvm/test/CodeGen/NVPTX/f16-instructions.ll
M llvm/test/CodeGen/NVPTX/f16x2-instructions.ll
M llvm/test/CodeGen/NVPTX/libcall-intrinsic.ll
M llvm/test/CodeGen/PowerPC/f128-arith.ll
M llvm/test/CodeGen/RISCV/double-intrinsics.ll
M llvm/test/CodeGen/RISCV/float-intrinsics.ll
M llvm/test/CodeGen/RISCV/rv64i-single-softfloat.ll
M llvm/test/CodeGen/SystemZ/fp-libcall.ll
M llvm/test/CodeGen/Thumb2/float-intrinsics-double.ll
M llvm/test/CodeGen/Thumb2/float-intrinsics-float.ll
M llvm/test/CodeGen/Thumb2/intrinsics-cc.ll
M llvm/test/CodeGen/WebAssembly/libcalls.ll
M llvm/test/CodeGen/WebAssembly/simd-unsupported.ll
M llvm/test/CodeGen/X86/2007-09-27-LDIntrinsics.ll
M llvm/test/CodeGen/X86/2010-05-07-ldconvert.ll
M llvm/test/CodeGen/X86/powi-windows.ll
M llvm/test/CodeGen/X86/powi.ll
M llvm/test/CodeGen/X86/tailcall-multiret.ll
M llvm/test/CodeGen/X86/vector-intrinsics.ll
M llvm/test/CodeGen/XCore/float-intrinsics.ll
M llvm/test/Transforms/InstCombine/fdiv.ll
M llvm/test/Transforms/InstCombine/intrinsics.ll
M llvm/test/Transforms/InstCombine/pow-4.ll
M llvm/test/Transforms/InstCombine/pow_fp_int.ll
M llvm/test/Transforms/InstCombine/pow_fp_int16.ll
M llvm/test/Transforms/InstSimplify/ConstProp/math-2.ll
M llvm/test/Transforms/InstSimplify/call.ll
M llvm/test/Transforms/InstSimplify/floating-point-compare.ll
M llvm/test/Transforms/InstSimplify/fold-intrinsics.ll
M llvm/test/Transforms/LICM/hoist-round.ll
M llvm/test/Transforms/LoopVectorize/intrinsic.ll
M llvm/test/Transforms/SLPVectorizer/X86/extract_in_tree_user.ll
M llvm/test/Transforms/SLPVectorizer/X86/intrinsic.ll
M llvm/test/Transforms/Scalarizer/intrinsics.ll
M llvm/unittests/Analysis/ValueTrackingTest.cpp
Log Message:
-----------
Update @llvm.powi to handle different int sizes for the exponent
This can be seen as a follow up to commit 0ee439b705e82a4fe20e2,
that changed the second argument of __powidf2, __powisf2 and
__powitf2 in compiler-rt from si_int to int. That was to align with
how those runtimes are defined in libgcc.
One thing that seem to have been missing in that patch was to make
sure that the rest of LLVM also handle that the argument now depends
on the size of int (not using the si_int machine mode for 32-bit).
When using __builtin_powi for a target with 16-bit int clang crashed.
And when emitting libcalls to those rtlib functions, typically when
lowering @llvm.powi), the backend would always prepare the exponent
argument as an i32 which caused miscompiles when the rtlib was
compiled with 16-bit int.
The solution used here is to use an overloaded type for the second
argument in @llvm.powi. This way clang can use the "correct" type
when lowering __builtin_powi, and then later when emitting the libcall
it is assumed that the type used in @llvm.powi matches the rtlib
function.
One thing that needed some extra attention was that when vectorizing
calls several passes did not support that several arguments could
be overloaded in the intrinsics. This patch allows overload of a
scalar operand by adding hasVectorInstrinsicOverloadedScalarOpd, with
an entry for powi.
Differential Revision: https://reviews.llvm.org/D99439
More information about the All-commits
mailing list