[llvm] [WebAssembly] Recognise EXTEND_HIGH (PR #123325)
Sam Parker via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 31 01:30:35 PST 2025
================
@@ -0,0 +1,442 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
+
+; RUN: llc < %s -mtriple=wasm32 -verify-machineinstrs -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -wasm-keep-registers -mattr=+simd128 | FileCheck %s --check-prefix=SIMD128
+
+target datalayout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-i128:128-n32:64-S128-ni:1:10:20"
+target triple = "wasm32"
+
+define i32 @sext_v8i8(ptr %in) {
+; SIMD128-LABEL: sext_v8i8:
+; SIMD128: .functype sext_v8i8 (i32) -> (i32)
+; SIMD128-NEXT: # %bb.0:
+; SIMD128-NEXT: v128.load64_zero $push14=, 0($0):p2align=0
+; SIMD128-NEXT: local.tee $push13=, $1=, $pop14
+; SIMD128-NEXT: i16x8.extend_low_i8x16_s $push3=, $pop13
+; SIMD128-NEXT: i32x4.extend_low_i16x8_s $push4=, $pop3
+; SIMD128-NEXT: i8x16.shuffle $push0=, $1, $1, 4, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+; SIMD128-NEXT: i16x8.extend_low_i8x16_s $push1=, $pop0
+; SIMD128-NEXT: i32x4.extend_low_i16x8_s $push2=, $pop1
+; SIMD128-NEXT: i32x4.add $push12=, $pop4, $pop2
+; SIMD128-NEXT: local.tee $push11=, $1=, $pop12
+; SIMD128-NEXT: i8x16.shuffle $push5=, $1, $1, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 0, 1, 2, 3
+; SIMD128-NEXT: i32x4.add $push10=, $pop11, $pop5
+; SIMD128-NEXT: local.tee $push9=, $1=, $pop10
+; SIMD128-NEXT: i8x16.shuffle $push6=, $1, $1, 4, 5, 6, 7, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3
+; SIMD128-NEXT: i32x4.add $push7=, $pop9, $pop6
+; SIMD128-NEXT: i32x4.extract_lane $push8=, $pop7, 0
+; SIMD128-NEXT: return $pop8
+ %narrow.load = load <8 x i8>, ptr %in, align 1
+ %sext = sext <8 x i8> %narrow.load to <8 x i32>
+ %res = tail call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %sext)
----------------
sparker-arm wrote:
Fair enough, I'll give it a go.
https://github.com/llvm/llvm-project/pull/123325
More information about the llvm-commits
mailing list