[PATCH] D89831: [AArch64][SVE] Fix umin/umax lowering to handle out of range imm.

Huihui Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 20 15:31:14 PDT 2020


huihuiz added a comment.

Current upstream mis-compile, take t.ll , run "llc -mtriple=aarch64-linux-gnu -mattr=+sve < t.ll"

  define <vscale x 4 x i32> @test(<vscale x 4 x i32> %a) {
    %pg = shufflevector <vscale x 4 x i1> insertelement (<vscale x 4 x i1> undef, i1 true, i32 0), <vscale x 4 x i1> undef, <vscale x 4 x i32> zeroinitializer
    %elt = insertelement <vscale x 4 x i32> undef, i32 257, i32 0
    %splat = shufflevector <vscale x 4 x i32> %elt, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
    %umin = call <vscale x 4 x i32> @llvm.aarch64.sve.umin.nxv4i32(<vscale x 4 x i1> %pg, <vscale x 4 x i32> %a, <vscale x 4 x i32> %splat)
    ret <vscale x 4 x i32> %umin
  }
  
  declare <vscale x 4 x i32> @llvm.aarch64.sve.umin.nxv4i32(<vscale x 4 x i1>, <vscale x 4 x i32>, <vscale x 4 x i32>)

Then you see it's mis-compiled into
// %bb.0:

  umin    z0.s, z0.s, #1

This patch fixes this error, and generate
// %bb.0:

  mov     w8, #257
  ptrue   p0.s
  mov     z1.s, w8
  umin    z0.s, p0/m, z0.s, z1.s
   


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89831/new/

https://reviews.llvm.org/D89831



More information about the llvm-commits mailing list