Open Validark opened 1 month ago
@llvm/issue-subscribers-backend-x86
Author: Niles Salter (Validark)
This can be handled more generally:
define dso_local range(i64 0, -9223372036854775807) <4 x i64> @src(<4 x i64> %0) local_unnamed_addr {
Entry:
%1 = icmp ult <4 x i64> %0, <i64 64, i64 64, i64 64, i64 64>
%2 = and <4 x i64> %0, <i64 63, i64 63, i64 63, i64 63>
%3 = shl nuw <4 x i64> <i64 1, i64 1, i64 1, i64 1>, %2
%4 = select <4 x i1> %1, <4 x i64> %3, <4 x i64> zeroinitializer
ret <4 x i64> %4
}
define dso_local range(i64 0, -9223372036854775807) <4 x i64> @tgt(<4 x i64> %0) local_unnamed_addr {
Entry:
%1 = freeze <4 x i64> %0
%2 = icmp ult <4 x i64> %1, <i64 64, i64 64, i64 64, i64 64>
%3 = shl nuw <4 x i64> <i64 1, i64 1, i64 1, i64 1>, %1
%4 = select <4 x i1> %2, <4 x i64> %3, <4 x i64> zeroinitializer
ret <4 x i64> %4
}
Alive2: https://alive2.llvm.org/ce/z/MUmPV-
I wrote some Zig code trying to get the semantics of
vpsllvq
:Optimized LLVM:
Compiled for Zen 3:
I was expecting just a
vpsllvq
instruction.