[llvm] [RISCV][CG]Use processShuffleMasks for per-register shuffles (PR #120803)
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 2 09:35:15 PST 2025
preames wrote:
Reproducer:
```
source_filename = "hadamard_ac.c"
target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128"
target triple = "riscv64-unknown-unknown"
define i64 @crash(ptr nocapture noundef readonly %pix, i32 noundef signext %stride) local_unnamed_addr #0 {
entry:
%idx.ext55 = sext i32 %stride to i64
%arrayidx11 = getelementptr inbounds nuw i8, ptr %pix, i64 2
%add.ptr56 = getelementptr inbounds i8, ptr %pix, i64 %idx.ext55
%add.ptr56.1 = getelementptr inbounds i8, ptr %add.ptr56, i64 %idx.ext55
%add.ptr56.2 = getelementptr inbounds i8, ptr %add.ptr56.1, i64 %idx.ext55
%add.ptr56.3 = getelementptr inbounds i8, ptr %add.ptr56.2, i64 %idx.ext55
%arrayidx4.4 = getelementptr inbounds nuw i8, ptr %add.ptr56.3, i64 1
%arrayidx11.4 = getelementptr inbounds nuw i8, ptr %add.ptr56.3, i64 2
%arrayidx13.4 = getelementptr inbounds nuw i8, ptr %add.ptr56.3, i64 3
%arrayidx27.4 = getelementptr inbounds nuw i8, ptr %add.ptr56.3, i64 4
%arrayidx29.4 = getelementptr inbounds nuw i8, ptr %add.ptr56.3, i64 5
%arrayidx39.4 = getelementptr inbounds nuw i8, ptr %add.ptr56.3, i64 6
%arrayidx41.4 = getelementptr inbounds nuw i8, ptr %add.ptr56.3, i64 7
%0 = tail call <4 x i8> @llvm.experimental.vp.strided.load.v4i8.p0.i64(ptr align 1 %pix, i64 %idx.ext55, <4 x i1> splat (i1 true), i32 4), !tbaa !6
%1 = shufflevector <4 x i8> %0, <4 x i8> poison, <4 x i32> <i32 2, i32 3, i32 1, i32 0>
%2 = tail call <4 x i8> @llvm.experimental.vp.strided.load.v4i8.p0.i64(ptr nonnull align 1 %arrayidx11, i64 %idx.ext55, <4 x i1> splat (i1 true), i32 4), !tbaa !6
%3 = shufflevector <4 x i8> %2, <4 x i8> poison, <4 x i32> <i32 2, i32 3, i32 1, i32 0>
%4 = insertelement <8 x ptr> poison, ptr %add.ptr56.1, i64 0
%5 = insertelement <8 x ptr> %4, ptr %add.ptr56.2, i64 1
%6 = insertelement <8 x ptr> %5, ptr %add.ptr56, i64 2
%7 = insertelement <8 x ptr> %6, ptr %pix, i64 3
%8 = shufflevector <8 x ptr> %7, <8 x ptr> poison, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3>
%9 = getelementptr i8, <8 x ptr> %8, <8 x i64> <i64 6, i64 6, i64 6, i64 6, i64 4, i64 4, i64 4, i64 4>
%10 = tail call <8 x i8> @llvm.masked.gather.v8i8.v8p0(<8 x ptr> %9, i32 1, <8 x i1> splat (i1 true), <8 x i8> poison), !tbaa !6
%11 = shufflevector <8 x ptr> %7, <8 x ptr> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3>
%12 = getelementptr i8, <16 x ptr> %11, <16 x i64> <i64 3, i64 3, i64 3, i64 3, i64 1, i64 1, i64 1, i64 1, i64 7, i64 7, i64 7, i64 7, i64 5, i64 5, i64 5, i64 5>
%13 = tail call <16 x i8> @llvm.masked.gather.v16i8.v16p0(<16 x ptr> %12, i32 1, <16 x i1> splat (i1 true), <16 x i8> poison), !tbaa !6
%14 = tail call <4 x i8> @llvm.experimental.vp.strided.load.v4i8.p0.i64(ptr align 1 %add.ptr56.3, i64 %idx.ext55, <4 x i1> splat (i1 true), i32 4), !tbaa !6
%15 = shufflevector <4 x i8> %14, <4 x i8> poison, <4 x i32> <i32 2, i32 3, i32 1, i32 0>
%16 = tail call <4 x i8> @llvm.experimental.vp.strided.load.v4i8.p0.i64(ptr nonnull align 1 %arrayidx4.4, i64 %idx.ext55, <4 x i1> splat (i1 true), i32 4), !tbaa !6
%17 = shufflevector <4 x i8> %16, <4 x i8> poison, <4 x i32> <i32 2, i32 3, i32 1, i32 0>
%18 = tail call <4 x i8> @llvm.experimental.vp.strided.load.v4i8.p0.i64(ptr nonnull align 1 %arrayidx11.4, i64 %idx.ext55, <4 x i1> splat (i1 true), i32 4), !tbaa !6
%19 = shufflevector <4 x i8> %18, <4 x i8> poison, <4 x i32> <i32 2, i32 3, i32 1, i32 0>
%20 = tail call <4 x i8> @llvm.experimental.vp.strided.load.v4i8.p0.i64(ptr nonnull align 1 %arrayidx13.4, i64 %idx.ext55, <4 x i1> splat (i1 true), i32 4), !tbaa !6
%21 = shufflevector <4 x i8> %20, <4 x i8> poison, <4 x i32> <i32 2, i32 3, i32 1, i32 0>
%22 = tail call <4 x i8> @llvm.experimental.vp.strided.load.v4i8.p0.i64(ptr nonnull align 1 %arrayidx27.4, i64 %idx.ext55, <4 x i1> splat (i1 true), i32 4), !tbaa !6
%23 = shufflevector <4 x i8> %22, <4 x i8> poison, <4 x i32> <i32 2, i32 3, i32 1, i32 0>
%24 = tail call <4 x i8> @llvm.experimental.vp.strided.load.v4i8.p0.i64(ptr nonnull align 1 %arrayidx29.4, i64 %idx.ext55, <4 x i1> splat (i1 true), i32 4), !tbaa !6
%25 = shufflevector <4 x i8> %24, <4 x i8> poison, <4 x i32> <i32 2, i32 3, i32 1, i32 0>
%26 = tail call <4 x i8> @llvm.experimental.vp.strided.load.v4i8.p0.i64(ptr nonnull align 1 %arrayidx39.4, i64 %idx.ext55, <4 x i1> splat (i1 true), i32 4), !tbaa !6
%27 = shufflevector <4 x i8> %26, <4 x i8> poison, <4 x i32> <i32 2, i32 3, i32 1, i32 0>
%28 = shufflevector <8 x i8> %10, <8 x i8> poison, <32 x i32> <i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
%29 = shufflevector <4 x i8> %3, <4 x i8> poison, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
%30 = shufflevector <32 x i8> %29, <32 x i8> %28, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 poison, i32 poison, i32 poison, i32 poison, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
%31 = shufflevector <4 x i8> %1, <4 x i8> poison, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
%32 = shufflevector <32 x i8> %30, <32 x i8> %31, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 32, i32 33, i32 34, i32 35, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
%33 = shufflevector <4 x i8> %19, <4 x i8> poison, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
%34 = shufflevector <32 x i8> %32, <32 x i8> %33, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 32, i32 33, i32 34, i32 35, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
%35 = shufflevector <4 x i8> %15, <4 x i8> poison, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
%36 = shufflevector <32 x i8> %34, <32 x i8> %35, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 32, i32 33, i32 34, i32 35, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
%37 = shufflevector <4 x i8> %27, <4 x i8> poison, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
%38 = shufflevector <32 x i8> %36, <32 x i8> %37, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 32, i32 33, i32 34, i32 35, i32 poison, i32 poison, i32 poison, i32 poison>
%39 = shufflevector <4 x i8> %23, <4 x i8> poison, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
%40 = shufflevector <32 x i8> %38, <32 x i8> %39, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 32, i32 33, i32 34, i32 35>
%41 = zext <32 x i8> %40 to <32 x i32>
%42 = tail call <4 x i8> @llvm.experimental.vp.strided.load.v4i8.p0.i64(ptr nonnull align 1 %arrayidx41.4, i64 %idx.ext55, <4 x i1> splat (i1 true), i32 4), !tbaa !6
%43 = shufflevector <4 x i8> %42, <4 x i8> poison, <4 x i32> <i32 2, i32 3, i32 1, i32 0>
%44 = shufflevector <16 x i8> %13, <16 x i8> poison, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
%45 = shufflevector <4 x i8> %21, <4 x i8> poison, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
%46 = shufflevector <32 x i8> %44, <32 x i8> %45, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 32, i32 33, i32 34, i32 35, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
%47 = shufflevector <4 x i8> %17, <4 x i8> poison, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
%48 = shufflevector <32 x i8> %46, <32 x i8> %47, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 32, i32 33, i32 34, i32 35, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
%49 = shufflevector <4 x i8> %43, <4 x i8> poison, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
%50 = shufflevector <32 x i8> %48, <32 x i8> %49, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 32, i32 33, i32 34, i32 35, i32 poison, i32 poison, i32 poison, i32 poison>
%51 = shufflevector <4 x i8> %25, <4 x i8> poison, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
%52 = shufflevector <32 x i8> %50, <32 x i8> %51, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 32, i32 33, i32 34, i32 35>
%53 = zext <32 x i8> %52 to <32 x i32>
%54 = add nuw nsw <32 x i32> %53, %41
%55 = sub nsw <32 x i32> %41, %53
%56 = shl nsw <32 x i32> %55, splat (i32 16)
%57 = or disjoint <32 x i32> %56, %54
%58 = shufflevector <32 x i32> %57, <32 x i32> poison, <32 x i32> <i32 4, i32 5, i32 6, i32 7, i32 0, i32 1, i32 2, i32 3, i32 12, i32 13, i32 14, i32 15, i32 8, i32 9, i32 10, i32 11, i32 20, i32 21, i32 22, i32 23, i32 16, i32 17, i32 18, i32 19, i32 28, i32 29, i32 30, i32 31, i32 24, i32 25, i32 26, i32 27>
%59 = add nsw <32 x i32> %57, %58
%60 = sub nsw <32 x i32> %57, %58
%61 = shufflevector <32 x i32> %59, <32 x i32> %60, <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 36, i32 37, i32 38, i32 39, i32 8, i32 9, i32 10, i32 11, i32 44, i32 45, i32 46, i32 47, i32 16, i32 17, i32 18, i32 19, i32 52, i32 53, i32 54, i32 55, i32 24, i32 25, i32 26, i32 27, i32 60, i32 61, i32 62, i32 63>
%62 = shufflevector <32 x i32> %59, <32 x i32> %60, <32 x i32> <i32 1, i32 0, i32 3, i32 2, i32 37, i32 36, i32 39, i32 38, i32 9, i32 8, i32 11, i32 10, i32 45, i32 44, i32 47, i32 46, i32 17, i32 16, i32 19, i32 18, i32 53, i32 52, i32 55, i32 54, i32 25, i32 24, i32 27, i32 26, i32 61, i32 60, i32 63, i32 62>
%63 = sub nsw <32 x i32> %61, %62
%64 = add nsw <32 x i32> %61, %62
%65 = shufflevector <32 x i32> %63, <32 x i32> %64, <32 x i32> <i32 0, i32 33, i32 34, i32 3, i32 4, i32 37, i32 38, i32 7, i32 8, i32 41, i32 42, i32 11, i32 12, i32 45, i32 46, i32 15, i32 16, i32 49, i32 50, i32 19, i32 20, i32 53, i32 54, i32 23, i32 24, i32 57, i32 58, i32 27, i32 28, i32 61, i32 62, i32 31>
%66 = shufflevector <32 x i32> %63, <32 x i32> %64, <32 x i32> <i32 3, i32 34, i32 33, i32 0, i32 7, i32 38, i32 37, i32 4, i32 11, i32 42, i32 41, i32 8, i32 15, i32 46, i32 45, i32 12, i32 19, i32 50, i32 49, i32 16, i32 23, i32 54, i32 53, i32 20, i32 27, i32 58, i32 57, i32 24, i32 31, i32 62, i32 61, i32 28>
%67 = add nsw <32 x i32> %65, %66
%68 = sub nsw <32 x i32> %65, %66
%69 = shufflevector <32 x i32> %67, <32 x i32> %68, <32 x i32> <i32 0, i32 1, i32 34, i32 35, i32 4, i32 5, i32 38, i32 39, i32 8, i32 9, i32 42, i32 43, i32 12, i32 13, i32 46, i32 47, i32 16, i32 17, i32 50, i32 51, i32 20, i32 21, i32 54, i32 55, i32 24, i32 25, i32 58, i32 59, i32 28, i32 29, i32 62, i32 63>
%70 = lshr <32 x i32> %69, splat (i32 15)
%71 = and <32 x i32> %70, splat (i32 65537)
%72 = mul nuw <32 x i32> %71, splat (i32 65535)
%73 = add <32 x i32> %72, %69
%74 = xor <32 x i32> %73, %72
%75 = shufflevector <32 x i32> %67, <32 x i32> %68, <32 x i32> <i32 8, i32 9, i32 42, i32 43, i32 12, i32 13, i32 46, i32 47, i32 0, i32 1, i32 34, i32 35, i32 4, i32 5, i32 38, i32 39, i32 24, i32 25, i32 58, i32 59, i32 28, i32 29, i32 62, i32 63, i32 16, i32 17, i32 50, i32 51, i32 20, i32 21, i32 54, i32 55>
%76 = sub <32 x i32> %69, %75
%77 = add <32 x i32> %69, %75
%78 = shufflevector <32 x i32> %76, <32 x i32> %77, <32 x i32> <i32 17, i32 57, i32 41, i32 1, i32 16, i32 56, i32 40, i32 0, i32 18, i32 58, i32 42, i32 2, i32 19, i32 59, i32 43, i32 3, i32 21, i32 61, i32 45, i32 5, i32 20, i32 60, i32 44, i32 4, i32 22, i32 62, i32 46, i32 6, i32 23, i32 63, i32 47, i32 7>
%79 = shufflevector <32 x i32> %76, <32 x i32> %77, <32 x i32> <i32 1, i32 41, i32 57, i32 17, i32 0, i32 40, i32 56, i32 16, i32 2, i32 42, i32 58, i32 18, i32 3, i32 43, i32 59, i32 19, i32 5, i32 45, i32 61, i32 21, i32 4, i32 44, i32 60, i32 20, i32 6, i32 46, i32 62, i32 22, i32 7, i32 47, i32 63, i32 23>
%80 = add nsw <32 x i32> %78, %79
%81 = sub nsw <32 x i32> %78, %79
%82 = shufflevector <32 x i32> %80, <32 x i32> %81, <32 x i32> <i32 0, i32 1, i32 34, i32 35, i32 4, i32 5, i32 38, i32 39, i32 8, i32 9, i32 42, i32 43, i32 12, i32 13, i32 46, i32 47, i32 16, i32 17, i32 50, i32 51, i32 20, i32 21, i32 54, i32 55, i32 24, i32 25, i32 58, i32 59, i32 28, i32 29, i32 62, i32 63>
%83 = lshr <32 x i32> %82, splat (i32 15)
%84 = and <32 x i32> %83, splat (i32 65537)
%85 = mul nuw <32 x i32> %84, splat (i32 65535)
%86 = add <32 x i32> %85, %82
%87 = xor <32 x i32> %86, %85
%88 = tail call i32 @llvm.vector.reduce.add.v32i32(<32 x i32> %87)
%89 = tail call i32 @llvm.vector.reduce.add.v32i32(<32 x i32> %74)
%90 = extractelement <32 x i32> %77, i64 9
%91 = extractelement <32 x i32> %67, i64 17
%add183 = add i32 %90, %91
%92 = extractelement <32 x i32> %67, i64 25
%add185 = add i32 %add183, %92
%conv187 = and i32 %add185, 65535
%conv189 = and i32 %89, 65535
%shr = lshr i32 %89, 16
%add190 = add nuw nsw i32 %conv189, %shr
%sub191 = sub nsw i32 %add190, %conv187
%conv193 = and i32 %88, 65535
%shr194 = lshr i32 %88, 16
%add195 = add nuw nsw i32 %conv193, %shr194
%sub196 = sub nsw i32 %add195, %conv187
%conv197 = sext i32 %sub196 to i64
%shl198 = shl nsw i64 %conv197, 32
%conv199 = sext i32 %sub191 to i64
%add200 = add nsw i64 %shl198, %conv199
ret i64 %add200
}
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(read)
declare <8 x i8> @llvm.masked.gather.v8i8.v8p0(<8 x ptr>, i32 immarg, <8 x i1>, <8 x i8>) #1
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: read)
declare <4 x i8> @llvm.experimental.vp.strided.load.v4i8.p0.i64(ptr nocapture, i64, <4 x i1>, i32) #2
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(read)
declare <16 x i8> @llvm.masked.gather.v16i8.v16p0(<16 x ptr>, i32 immarg, <16 x i1>, <16 x i8>) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v32i32(<32 x i32>) #3
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, inaccessiblemem: none) vscale_range(8,8) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="sifive-x280" "target-features"="+64bit,+a,+c,+d,+experimental,+f,+m,+relax,+v,+zaamo,+zalrsc,+zba,+zbb,+zfh,+zfhmin,+zicsr,+zifencei,+zmmul,+zve32f,+zve32x,+zve64d,+zve64f,+zve64x,+zvfh,+zvfhmin,+zvl128b,+zvl256b,+zvl32b,+zvl512b,+zvl64b,-b,-e,-experimental-smctr,-experimental-ssctr,-experimental-svukte,-experimental-xqcia,-experimental-xqciac,-experimental-xqcics,-experimental-xqcicsr,-experimental-xqcilsm,-experimental-xqcisls,-experimental-zalasr,-experimental-zicfilp,-experimental-zicfiss,-experimental-zvbc32e,-experimental-zvkgs,-h,-sha,-shcounterenw,-shgatpa,-shtvala,-shvsatpa,-shvstvala,-shvstvecd,-smaia,-smcdeleg,-smcsrind,-smdbltrp,-smepmp,-smmpm,-smnpm,-smrnmi,-smstateen,-ssaia,-ssccfg,-ssccptr,-sscofpmf,-sscounterenw,-sscsrind,-ssdbltrp,-ssnpm,-sspm,-ssqosid,-ssstateen,-ssstrict,-sstc,-sstvala,-sstvecd,-ssu64xl,-supm,-svade,-svadu,-svbare,-svinval,-svnapot,-svpbmt,-svvptc,-xcvalu,-xcvbi,-xcvbitmanip,-xcvelw,-xcvmac,-xcvmem,-xcvsimd,-xsfcease,-xsfvcp,-xsfvfnrclipxfqf,-xsfvfwmaccqqq,-xsfvqmaccdod,-xsfvqmaccqoq,-xsifivecdiscarddlone,-xsifivecflushdlone,-xtheadba,-xtheadbb,-xtheadbs,-xtheadcmo,-xtheadcondmov,-xtheadfmemidx,-xtheadmac,-xtheadmemidx,-xtheadmempair,-xtheadsync,-xtheadvdot,-xventanacondops,-xwchc,-za128rs,-za64rs,-zabha,-zacas,-zama16b,-zawrs,-zbc,-zbkb,-zbkc,-zbkx,-zbs,-zca,-zcb,-zcd,-zce,-zcf,-zcmop,-zcmp,-zcmt,-zdinx,-zfa,-zfbfmin,-zfinx,-zhinx,-zhinxmin,-zic64b,-zicbom,-zicbop,-zicboz,-ziccamoa,-ziccif,-zicclsm,-ziccrse,-zicntr,-zicond,-zihintntl,-zihintpause,-zihpm,-zimop,-zk,-zkn,-zknd,-zkne,-zknh,-zkr,-zks,-zksed,-zksh,-zkt,-ztso,-zvbb,-zvbc,-zvfbfmin,-zvfbfwma,-zvkb,-zvkg,-zvkn,-zvknc,-zvkned,-zvkng,-zvknha,-zvknhb,-zvks,-zvksc,-zvksed,-zvksg,-zvksh,-zvkt,-zvl1024b,-zvl16384b,-zvl2048b,-zvl32768b,-zvl4096b,-zvl65536b,-zvl8192b" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(read) }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: read) }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
!llvm.module.flags = !{!0, !1, !2, !4}
!llvm.ident = !{!5}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 1, !"target-abi", !"lp64d"}
!2 = !{i32 6, !"riscv-isa", !3}
!3 = !{!"rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_v1p0_zicsr2p0_zifencei2p0_zmmul1p0_zaamo1p0_zalrsc1p0_zfh1p0_zfhmin1p0_zba1p0_zbb1p0_zve32f1p0_zve32x1p0_zve64d1p0_zve64f1p0_zve64x1p0_zvfh1p0_zvfhmin1p0_zvl128b1p0_zvl256b1p0_zvl32b1p0_zvl512b1p0_zvl64b1p0"}
!4 = !{i32 8, !"SmallDataLimit", i32 0}
!5 = !{!"clang version 20.0.0git (https://github.com/llvm/llvm-project.git 428daa1ccf87266f6c3d8284909777c5b832d364)"}
!6 = !{!7, !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
```
Just feed the above to llc with your patch applied. I tried using bugpoint to reduce further, but it kept stumbling across others bugs.
https://github.com/llvm/llvm-project/pull/120803
More information about the llvm-commits
mailing list