[all-commits] [llvm/llvm-project] 348f22: Correct gcc vector splat conversion from float to ...
Erich Keane via All-commits
all-commits at lists.llvm.org
Fri Dec 13 12:27:45 PST 2019
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 348f22eac83d9a3ee946e41be43fe507f04a89b6
https://github.com/llvm/llvm-project/commit/348f22eac83d9a3ee946e41be43fe507f04a89b6
Author: Erich Keane <erich.keane at intel.com>
Date: 2019-12-13 (Fri, 13 Dec 2019)
Changed paths:
M clang/lib/Sema/SemaExpr.cpp
M clang/test/CodeGenCXX/vector-splat-conversion.cpp
Log Message:
-----------
Correct gcc vector splat conversion from float to int-vector
In looking into some other code, I came across this issue where a
float converted to a gcc integer vector via a splat causes it to miss
the float-to-integral cast, which causes some REALLY strange codegen
bugs.
The AST looked like:
`-ImplicitCastExpr <col:13>
'gcc_int_2':'__attribute__((__vector_size__(2 * sizeof(int)))) int' <VectorSplat>
`-ImplicitCastExpr <col:13> 'float' <LValueToRValue>
`-DeclRefExpr <col:13> 'float' lvalue ParmVar
0x556f16a5dc90 'f' 'float'
Despite the type of the VectorSplat cast as printed, it ended up
becoming a vector of float, which caused non-matching instructions. For
example, IntVector + a float constant resulted in:
add <2 x i32> %8, <2 x float> <float 3.000000e+00, float 3.000000e+00>
This patch corrects the conversion so that the float is first converted
to an integral, THEN splatted.
More information about the All-commits
mailing list