[llvm-bugs] [Bug 49210] Fuse v128.load64_zero + iXX.widen_low into Load-and-Extend

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 8 12:09:50 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=49210

Thomas Lively <tlively at google.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WORKSFORME
             Status|NEW                         |RESOLVED

--- Comment #1 from Thomas Lively <tlively at google.com> ---
This C file:

```
#include <smmintrin.h>

__m128i fused(__m128i* ptr) {
  return _mm_cvtepi16_epi32(_mm_loadl_epi64(ptr));
}
```

compiled with:

`emcc -msse4.1 -msimd128 fused.c -O2 -c -S -o -`

Produces this assembly, as expected:

```
fused:                                  # @fused
        .functype       fused (i32) -> (v128)
# %bb.0:                                # %entry
        local.get       0
        i32x4.load16x4_s        0:p2align=0
                                        # fallthrough-return
        end_function
```

Via this LLVM IR:

```
; ModuleID = '/usr/local/google/home/tlively/code/llvm-local/fused.c'
source_filename = "/usr/local/google/home/tlively/code/llvm-local/fused.c"
target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128-ni:1"
target triple = "wasm32-unknown-emscripten"

; Function Attrs: nofree norecurse nosync nounwind readonly willreturn
mustprogress
define hidden <4 x i32> @fused(<4 x i32>* nocapture readonly %ptr)
local_unnamed_addr #0 {
entry:
  %0 = bitcast <4 x i32>* %ptr to <4 x i16>*
  %1 = load <4 x i16>, <4 x i16>* %0, align 1, !tbaa !2
  %conv.i.i.i = sext <4 x i16> %1 to <4 x i32>
  ret <4 x i32> %conv.i.i.i
}

attributes #0 = { nofree norecurse nosync nounwind readonly willreturn
mustprogress "frame-pointer"="none" "min-legal-vector-width"="128"
"no-trapping-math"="true" "stack-protector-buffer-size"="8"
"target-cpu"="generic" "target-features"="+simd128" }

!llvm.module.flags = !{!0}
!llvm.ident = !{!1}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{!"clang version 13.0.0 (https://github.com/llvm/llvm-project
9b0ddc2662addaa563b632c577996e515e1a7802)"}
!2 = !{!3, !3, i64 0}
!3 = !{!"omnipotent char", !4, i64 0}
!4 = !{!"Simple C/C++ TBAA"}
```

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210708/45e93808/attachment.html>


More information about the llvm-bugs mailing list