Skip to content

[llvm][RISCV] Support RISCV vector tuple type in llvm IR #97992

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

4vtomat
Copy link
Member

@4vtomat 4vtomat commented Jul 8, 2024

Summary:
This patch proposes new llvm types for RISCV vector tuples represented as TargetExtType which contains both LMUL and NF(num_fields) information and keep it all the way down to selectionDAG to match the corresponding MVT(support in the following patch).

Detail:
Currently we have built-in C types for RISCV vector tuple type, e.g. vint32m1x2_t, however it's is represented as structure of scalable vector types, i.e. {<vscale x 2 x i32>, <vscale x 2 x i32>}. It loses the information for num_fields(NF) as struct is flattened during selectionDAG, thus it makes it not possible to handle inline assembly of vector tuple type, it also makes the calling convention of vector tuple types handing not strait forward and hard to realize the allocation code, i.e. RVVArgDispatcher.

The llvm IR for the example above is then represented as target("riscv.vector.tuple", <vscale x 8 x i8>, 2) in which the first type parameter is the equivalent size scalable vecotr of i8 element type, the following integer parameter is the NF of the tuple.

The new RISCV specific vector insert/extract intrinsics are also added as llvm.riscv.vector.insert and llvm.riscv.vector.extract to handle tuple type subvector insertion/extraction since the generic ones only operates on VectorType but not TargetExtType.

There are total of 32 llvm types added for each VREGS * NF <= 8, where VREGS is the vector registers needed for each LMUL and NF is num_fields.
The name of types are:

target("riscv.vector.tuple", <vscale x 1 x i8>, 2)  // LMUL = mf8, NF = 2
target("riscv.vector.tuple", <vscale x 1 x i8>, 3)  // LMUL = mf8, NF = 3
target("riscv.vector.tuple", <vscale x 1 x i8>, 4)  // LMUL = mf8, NF = 4
target("riscv.vector.tuple", <vscale x 1 x i8>, 5)  // LMUL = mf8, NF = 5
target("riscv.vector.tuple", <vscale x 1 x i8>, 6)  // LMUL = mf8, NF = 6
target("riscv.vector.tuple", <vscale x 1 x i8>, 7)  // LMUL = mf8, NF = 7
target("riscv.vector.tuple", <vscale x 1 x i8>, 8)  // LMUL = mf8, NF = 8
target("riscv.vector.tuple", <vscale x 2 x i8>, 2)  // LMUL = mf4, NF = 2
target("riscv.vector.tuple", <vscale x 2 x i8>, 3)  // LMUL = mf4, NF = 3
target("riscv.vector.tuple", <vscale x 2 x i8>, 4)  // LMUL = mf4, NF = 4
target("riscv.vector.tuple", <vscale x 2 x i8>, 5)  // LMUL = mf4, NF = 5
target("riscv.vector.tuple", <vscale x 2 x i8>, 6)  // LMUL = mf4, NF = 6
target("riscv.vector.tuple", <vscale x 2 x i8>, 7)  // LMUL = mf4, NF = 7
target("riscv.vector.tuple", <vscale x 2 x i8>, 8)  // LMUL = mf4, NF = 8
target("riscv.vector.tuple", <vscale x 4 x i8>, 2)  // LMUL = mf2, NF = 2
target("riscv.vector.tuple", <vscale x 4 x i8>, 3)  // LMUL = mf2, NF = 3
target("riscv.vector.tuple", <vscale x 4 x i8>, 4)  // LMUL = mf2, NF = 4
target("riscv.vector.tuple", <vscale x 4 x i8>, 5)  // LMUL = mf2, NF = 5
target("riscv.vector.tuple", <vscale x 4 x i8>, 6)  // LMUL = mf2, NF = 6
target("riscv.vector.tuple", <vscale x 4 x i8>, 7)  // LMUL = mf2, NF = 7
target("riscv.vector.tuple", <vscale x 4 x i8>, 8)  // LMUL = mf2, NF = 8
target("riscv.vector.tuple", <vscale x 8 x i8>, 2)  // LMUL = m1, NF = 2
target("riscv.vector.tuple", <vscale x 8 x i8>, 3)  // LMUL = m1, NF = 3
target("riscv.vector.tuple", <vscale x 8 x i8>, 4)  // LMUL = m1, NF = 4
target("riscv.vector.tuple", <vscale x 8 x i8>, 5)  // LMUL = m1, NF = 5
target("riscv.vector.tuple", <vscale x 8 x i8>, 6)  // LMUL = m1, NF = 6
target("riscv.vector.tuple", <vscale x 8 x i8>, 7)  // LMUL = m1, NF = 7
target("riscv.vector.tuple", <vscale x 8 x i8>, 8)  // LMUL = m1, NF = 8
target("riscv.vector.tuple", <vscale x 16 x i8>, 2) // LMUL = m2, NF = 2
target("riscv.vector.tuple", <vscale x 16 x i8>, 3) // LMUL = m2, NF = 3
target("riscv.vector.tuple", <vscale x 16 x i8>, 4) // LMUL = m2, NF = 4
target("riscv.vector.tuple", <vscale x 32 x i8>, 2) // LMUL = m4, NF = 2

RFC: https://discourse.llvm.org/t/rfc-support-riscv-vector-tuple-type-in-llvm/80005

@llvmbot llvmbot added clang Clang issues not falling into any other category backend:RISC-V clang:frontend Language frontend issues, e.g. anything involving "Sema" clang:codegen IR generation bugs: mangling, exceptions, etc. llvm:ir llvm:analysis llvm:transforms labels Jul 8, 2024
@llvmbot
Copy link
Member

llvmbot commented Jul 8, 2024

@llvm/pr-subscribers-clang-codegen
@llvm/pr-subscribers-llvm-ir
@llvm/pr-subscribers-llvm-analysis
@llvm/pr-subscribers-llvm-transforms

@llvm/pr-subscribers-clang

Author: Brandon Wu (4vtomat)

Changes

Currently we have built-in C types for RISCV vector tuple type, e.g.
vint32m1x2_t, however it's is represented as structure of scalable
vector types, i.e. {&lt;vscale x 2 x i32&gt;, &lt;vscale x 2 x i32&gt;}. It loses
the information for num_fields(NF) as struct is flattened during selection
DAG, thus it makes it not possible to handle inline assembly of vector
tuple type, it also makes the calling convention of vector tuple types
handing not strait forward and hard to realize the allocation code, i.e.
RVVArgDispatcher.

This patch supports RISCV vector tuple types represented as TargetExtType
which contains both LMUL and NF(num_fields) information and keep it all the
way down to selectionDAG to match the corresponding MVT(support in the
following patch). The llvm IR for the example above is then represented
as target("riscv_m1x2", i8, i8, log2(1) + 3, 2) in which the LMUL is
encoded as it's log2 value plus 3 as TargetExtType only accepts unsigned
value so it needs additional offset value.

The new RISCV specific vector insert/extract intrinsics are also added
as llvm.riscv.vector.insert and llvm.riscv.vector.extract to handle
tuple type subvector inserttoin/extraction since the generic ones only
operates on VectorType but not TargetExtType.

There are total of 32 llvm types added for each VREGS * NF &lt;= 8, where
VREGS is the vector registers needed for each LMUL and NF is num_fields.
The name of types are:

riscv_mf8x2, riscv_mf8x3, riscv_mf8x4, riscv_mf8x5, riscv_mf8x6, riscv_mf8x7, riscv_mf8x8,
riscv_mf4x2, riscv_mf4x3, riscv_mf4x4, riscv_mf4x5, riscv_mf4x6, riscv_mf4x7, riscv_mf4x8,
riscv_mf2x2, riscv_mf2x3, riscv_mf2x4, riscv_mf2x5, riscv_mf2x6, riscv_mf2x7, riscv_mf2x8,
riscv_m1x2, riscv_m1x3, riscv_m1x4, riscv_m1x5, riscv_m1x6, riscv_m1x7, riscv_m1x8,
riscv_m2x2, riscv_m2x3, riscv_m2x4,
riscv_m4x2.

Patch is 94.52 MiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/97992.diff

1007 Files Affected:

  • (modified) clang/include/clang/Basic/riscv_vector.td (+107-90)
  • (modified) clang/include/clang/Support/RISCVVIntrinsicUtils.h (+1)
  • (modified) clang/lib/CodeGen/CGBuiltin.cpp (+2-1)
  • (modified) clang/lib/CodeGen/CodeGenTypes.cpp (+18-7)
  • (modified) clang/lib/Support/RISCVVIntrinsicUtils.cpp (+1-1)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vcreate.c (+166-166)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vget.c (+50-50)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vloxseg2ei16.c (+30-30)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vloxseg3ei16.c (+24-24)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vloxseg4ei16.c (+24-24)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vloxseg5ei16.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vloxseg6ei16.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vloxseg7ei16.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vloxseg8ei16.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlseg2e16.c (+30-30)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlseg2e16ff.c (+60-90)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlseg3e16.c (+24-24)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlseg3e16ff.c (+48-88)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlseg4e16.c (+24-24)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlseg4e16ff.c (+48-104)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlseg5e16.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlseg5e16ff.c (+36-90)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlseg6e16.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlseg6e16ff.c (+36-102)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlseg7e16.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlseg7e16ff.c (+36-114)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlseg8e16.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlseg8e16ff.c (+36-126)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlsseg2e16.c (+30-30)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlsseg3e16.c (+24-24)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlsseg4e16.c (+24-24)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlsseg5e16.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlsseg6e16.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlsseg7e16.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlsseg8e16.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vluxseg2ei16.c (+30-30)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vluxseg3ei16.c (+24-24)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vluxseg4ei16.c (+24-24)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vluxseg5ei16.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vluxseg6ei16.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vluxseg7ei16.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vluxseg8ei16.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vset.c (+100-100)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsoxseg2ei16.c (+20-40)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsoxseg3ei16.c (+16-40)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsoxseg4ei16.c (+16-48)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsoxseg5ei16.c (+12-42)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsoxseg6ei16.c (+12-48)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsoxseg7ei16.c (+12-54)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsoxseg8ei16.c (+12-60)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsseg2e16.c (+20-40)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsseg3e16.c (+16-40)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsseg4e16.c (+16-48)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsseg5e16.c (+12-42)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsseg6e16.c (+12-48)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsseg7e16.c (+12-54)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsseg8e16.c (+12-60)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vssseg2e16.c (+20-40)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vssseg3e16.c (+16-40)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vssseg4e16.c (+16-48)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vssseg5e16.c (+12-42)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vssseg6e16.c (+12-48)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vssseg7e16.c (+12-54)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vssseg8e16.c (+12-60)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsuxseg2ei16.c (+20-40)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsuxseg3ei16.c (+16-40)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsuxseg4ei16.c (+16-48)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsuxseg5ei16.c (+12-42)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsuxseg6ei16.c (+12-48)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsuxseg7ei16.c (+12-54)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsuxseg8ei16.c (+12-60)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vundefined.c (+50-50)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vcreate.c (+1483-1483)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vget.c (+452-452)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg2ei16.c (+288-288)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg2ei32.c (+276-276)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg2ei64.c (+246-246)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg2ei8.c (+288-288)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg3ei16.c (+222-222)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg3ei32.c (+222-222)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg3ei64.c (+210-210)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg3ei8.c (+222-222)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg4ei16.c (+222-222)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg4ei32.c (+222-222)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg4ei64.c (+210-210)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg4ei8.c (+222-222)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg5ei16.c (+156-156)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg5ei32.c (+156-156)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg5ei64.c (+156-156)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg5ei8.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg6ei16.c (+156-156)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg6ei32.c (+156-156)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg6ei64.c (+156-156)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg6ei8.c (+156-156)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg7ei16.c (+156-156)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg7ei32.c (+156-156)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg7ei64.c (+156-156)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg7ei8.c (+156-156)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg8ei16.c (+156-156)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg8ei32.c (+156-156)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg8ei64.c (+156-156)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg8ei8.c (+156-156)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e16.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e16ff.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e32.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e32ff.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e64.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e64ff.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e8.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e8ff.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg3e16.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg3e16ff.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg3e32.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg3e32ff.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg3e64.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg3e64ff.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg3e8.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg3e8ff.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg4e16.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg4e16ff.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg4e32.c (+54-54)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg4e32ff.c (+108-234)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg4e64.c (+36-36)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg4e64ff.c (+72-156)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg4e8.c (+60-60)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg4e8ff.c (+120-260)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg5e16.c (+54-54)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg5e16ff.c (+108-270)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg5e32.c (+36-36)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg5e32ff.c (+72-180)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg5e64.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg5e64ff.c (+36-90)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg5e8.c (+48-48)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg5e8ff.c (+96-240)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg6e16.c (+54-54)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg6e16ff.c (+108-306)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg6e32.c (+36-36)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg6e32ff.c (+72-204)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg6e64.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg6e64ff.c (+36-102)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg6e8.c (+48-48)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg6e8ff.c (+96-272)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg7e16.c (+54-54)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg7e16ff.c (+108-342)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg7e32.c (+36-36)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg7e32ff.c (+72-228)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg7e64.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg7e64ff.c (+36-114)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg7e8.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg7e8ff.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg8e16.c (+54-54)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg8e16ff.c (+108-378)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg8e32.c (+36-36)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg8e32ff.c (+72-252)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg8e64.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg8e64ff.c (+36-126)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg8e8.c (+48-48)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg8e8ff.c (+96-336)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg2e16.c (+90-90)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg2e32.c (+72-72)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg2e64.c (+54-54)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg2e8.c (+72-72)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg3e16.c (+72-72)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg3e32.c (+54-54)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg3e64.c (+36-36)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg3e8.c (+60-60)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg4e16.c (+72-72)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg4e32.c (+54-54)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg4e64.c (+36-36)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg4e8.c (+60-60)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg5e16.c (+54-54)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg5e32.c (+36-36)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg5e64.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg5e8.c (+48-48)
diff --git a/clang/include/clang/Basic/riscv_vector.td b/clang/include/clang/Basic/riscv_vector.td
index a0820e2093bc2..67f480dec0fe3 100644
--- a/clang/include/clang/Basic/riscv_vector.td
+++ b/clang/include/clang/Basic/riscv_vector.td
@@ -762,8 +762,10 @@ multiclass RVVUnitStridedSegLoadTuple<string op> {
                                                    []<string>)),
             ManualCodegen = [{
     {
-      llvm::Type *ElementVectorType = cast<StructType>(ResultType)->elements()[0];
-      IntrinsicTypes = {ElementVectorType, Ops.back()->getType()};
+      if (IsMasked)
+        IntrinsicTypes = {ResultType, Ops[0]->getType(), Ops.back()->getType()};
+      else
+        IntrinsicTypes = {ResultType, Ops.back()->getType()};
       SmallVector<llvm::Value*, 12> Operands;
 
       bool NoPassthru =
@@ -772,11 +774,10 @@ multiclass RVVUnitStridedSegLoadTuple<string op> {
       unsigned Offset = IsMasked ? NoPassthru ? 1 : 2 : NoPassthru ? 0 : 1;
 
       if (NoPassthru) { // Push poison into passthru
-        Operands.append(NF, llvm::PoisonValue::get(ElementVectorType));
+        Operands.push_back(llvm::PoisonValue::get(ResultType));
       } else { // Push intrinsics operands into passthru
         llvm::Value *PassthruOperand = IsMasked ? Ops[1] : Ops[0];
-        for (unsigned I = 0; I < NF; ++I)
-          Operands.push_back(Builder.CreateExtractValue(PassthruOperand, {I}));
+        Operands.push_back(PassthruOperand);
       }
 
       Operands.push_back(Ops[Offset]); // Ptr
@@ -785,6 +786,7 @@ multiclass RVVUnitStridedSegLoadTuple<string op> {
       Operands.push_back(Ops[Offset + 1]); // VL
       if (IsMasked)
         Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
+      Operands.push_back(ConstantInt::get(Ops.back()->getType(), SegInstSEW));
 
       llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
 
@@ -828,24 +830,24 @@ multiclass RVVUnitStridedSegStoreTuple<string op> {
     {
       // Masked
       // Builtin: (mask, ptr, v_tuple, vl)
-      // Intrinsic: (val0, val1, ..., ptr, mask, vl)
+      // Intrinsic: (tuple, ptr, mask, vl)
       // Unmasked
       // Builtin: (ptr, v_tuple, vl)
-      // Intrinsic: (val0, val1, ..., ptr, vl)
+      // Intrinsic: (tuple, ptr, vl)
       unsigned Offset = IsMasked ? 1 : 0;
-      llvm::Value *VTupleOperand = Ops[Offset + 1];
 
       SmallVector<llvm::Value*, 12> Operands;
-      for (unsigned I = 0; I < NF; ++I) {
-        llvm::Value *V = Builder.CreateExtractValue(VTupleOperand, {I});
-        Operands.push_back(V);
-      }
+      Operands.push_back(Ops[Offset + 1]); // tuple
       Operands.push_back(Ops[Offset]); // Ptr
       if (IsMasked)
         Operands.push_back(Ops[0]);
       Operands.push_back(Ops[Offset + 2]); // VL
+      Operands.push_back(ConstantInt::get(Ops.back()->getType(), SegInstSEW));
 
-      IntrinsicTypes = {Operands[0]->getType(), Operands.back()->getType()};
+      if (IsMasked)
+        IntrinsicTypes = {Operands[0]->getType(), Ops[0]->getType(), Operands.back()->getType()};
+      else
+        IntrinsicTypes = {Operands[0]->getType(), Operands.back()->getType()};
       llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
       return Builder.CreateCall(F, Operands, "");
    }
@@ -880,8 +882,10 @@ multiclass RVVUnitStridedSegLoadFFTuple<string op> {
                                                    []<string>)),
             ManualCodegen = [{
     {
-      llvm::Type *ElementVectorType = cast<StructType>(ResultType)->elements()[0];
-      IntrinsicTypes = {ElementVectorType, Ops.back()->getType()};
+      if (IsMasked)
+        IntrinsicTypes = {ResultType, Ops.back()->getType(), Ops[0]->getType()};
+      else
+        IntrinsicTypes = {ResultType, Ops.back()->getType()};
       SmallVector<llvm::Value*, 12> Operands;
 
       bool NoPassthru =
@@ -890,11 +894,10 @@ multiclass RVVUnitStridedSegLoadFFTuple<string op> {
       unsigned Offset = IsMasked ? NoPassthru ? 1 : 2 : NoPassthru ? 0 : 1;
 
       if (NoPassthru) { // Push poison into passthru
-        Operands.append(NF, llvm::PoisonValue::get(ElementVectorType));
+        Operands.push_back(llvm::PoisonValue::get(ResultType));
       } else { // Push intrinsics operands into passthru
         llvm::Value *PassthruOperand = IsMasked ? Ops[1] : Ops[0];
-        for (unsigned I = 0; I < NF; ++I)
-          Operands.push_back(Builder.CreateExtractValue(PassthruOperand, {I}));
+        Operands.push_back(PassthruOperand);
       }
 
       Operands.push_back(Ops[Offset]); // Ptr
@@ -903,6 +906,7 @@ multiclass RVVUnitStridedSegLoadFFTuple<string op> {
       Operands.push_back(Ops[Offset + 2]); // vl
       if (IsMasked)
         Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
+      Operands.push_back(ConstantInt::get(Ops.back()->getType(), SegInstSEW));
 
       llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
 
@@ -911,14 +915,10 @@ multiclass RVVUnitStridedSegLoadFFTuple<string op> {
       clang::CharUnits Align =
           CGM.getNaturalPointeeTypeAlignment(E->getArg(Offset + 1)->getType());
 
-      llvm::Value *ReturnTuple = llvm::PoisonValue::get(ResultType);
-      for (unsigned I = 0; I < NF; ++I) {
-        llvm::Value *V = Builder.CreateExtractValue(LoadValue, {I});
-        ReturnTuple = Builder.CreateInsertValue(ReturnTuple, V, {I});
-      }
+      llvm::Value *ReturnTuple = Builder.CreateExtractValue(LoadValue, 0);
 
       // Store new_vl
-      llvm::Value *V = Builder.CreateExtractValue(LoadValue, {NF});
+      llvm::Value *V = Builder.CreateExtractValue(LoadValue, 1);
       Builder.CreateStore(V, Address(Ops[Offset + 1], V->getType(), Align));
 
       if (ReturnValue.isNull())
@@ -957,8 +957,10 @@ multiclass RVVStridedSegLoadTuple<string op> {
                                                    []<string>)),
             ManualCodegen = [{
     {
-      llvm::Type *ElementVectorType = cast<StructType>(ResultType)->elements()[0];
-      IntrinsicTypes = {ElementVectorType, Ops.back()->getType()};
+      if (IsMasked)
+        IntrinsicTypes = {ResultType, Ops.back()->getType(), Ops[0]->getType()};
+      else
+        IntrinsicTypes = {ResultType, Ops.back()->getType()};
       SmallVector<llvm::Value*, 12> Operands;
 
       bool NoPassthru =
@@ -967,11 +969,10 @@ multiclass RVVStridedSegLoadTuple<string op> {
       unsigned Offset = IsMasked ? NoPassthru ? 1 : 2 : NoPassthru ? 0 : 1;
 
       if (NoPassthru) { // Push poison into passthru
-        Operands.append(NF, llvm::PoisonValue::get(ElementVectorType));
+        Operands.push_back(llvm::PoisonValue::get(ResultType));
       } else { // Push intrinsics operands into passthru
         llvm::Value *PassthruOperand = IsMasked ? Ops[1] : Ops[0];
-        for (unsigned I = 0; I < NF; ++I)
-          Operands.push_back(Builder.CreateExtractValue(PassthruOperand, {I}));
+        Operands.push_back(PassthruOperand);
       }
 
       Operands.push_back(Ops[Offset]); // Ptr
@@ -981,6 +982,7 @@ multiclass RVVStridedSegLoadTuple<string op> {
       Operands.push_back(Ops[Offset + 2]); // VL
       if (IsMasked)
         Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
+      Operands.push_back(ConstantInt::get(Ops.back()->getType(), SegInstSEW));
 
       llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
       llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
@@ -1025,25 +1027,25 @@ multiclass RVVStridedSegStoreTuple<string op> {
     {
       // Masked
       // Builtin: (mask, ptr, stride, v_tuple, vl)
-      // Intrinsic: (val0, val1, ..., ptr, stride, mask, vl)
+      // Intrinsic: (tuple, ptr, stride, mask, vl)
       // Unmasked
       // Builtin: (ptr, stride, v_tuple, vl)
-      // Intrinsic: (val0, val1, ..., ptr, stride, vl)
+      // Intrinsic: (tuple, ptr, stride, vl)
       unsigned Offset = IsMasked ? 1 : 0;
-      llvm::Value *VTupleOperand = Ops[Offset + 2];
 
       SmallVector<llvm::Value*, 12> Operands;
-      for (unsigned I = 0; I < NF; ++I) {
-        llvm::Value *V = Builder.CreateExtractValue(VTupleOperand, {I});
-        Operands.push_back(V);
-      }
+      Operands.push_back(Ops[Offset + 2]); // tuple
       Operands.push_back(Ops[Offset]); // Ptr
       Operands.push_back(Ops[Offset + 1]); // Stride
       if (IsMasked)
         Operands.push_back(Ops[0]);
       Operands.push_back(Ops[Offset + 3]); // VL
+      Operands.push_back(ConstantInt::get(Ops.back()->getType(), SegInstSEW));
 
-      IntrinsicTypes = {Operands[0]->getType(), Operands.back()->getType()};
+      if (IsMasked)
+        IntrinsicTypes = {Operands[0]->getType(), Operands.back()->getType(), Ops[0]->getType()};
+      else
+        IntrinsicTypes = {Operands[0]->getType(), Operands.back()->getType()};
       llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
       return Builder.CreateCall(F, Operands, "");
     }
@@ -1073,8 +1075,6 @@ multiclass RVVIndexedSegLoadTuple<string op> {
                                                    []<string>)),
             ManualCodegen = [{
     {
-      llvm::Type *ElementVectorType = cast<StructType>(ResultType)->elements()[0];
-      IntrinsicTypes = {ElementVectorType, Ops.back()->getType()};
       SmallVector<llvm::Value*, 12> Operands;
 
       bool NoPassthru =
@@ -1083,11 +1083,10 @@ multiclass RVVIndexedSegLoadTuple<string op> {
       unsigned Offset = IsMasked ? NoPassthru ? 1 : 2 : NoPassthru ? 0 : 1;
 
       if (NoPassthru) { // Push poison into passthru
-        Operands.append(NF, llvm::PoisonValue::get(ElementVectorType));
+        Operands.push_back(llvm::PoisonValue::get(ResultType));
       } else { // Push intrinsics operands into passthru
         llvm::Value *PassthruOperand = IsMasked ? Ops[1] : Ops[0];
-        for (unsigned I = 0; I < NF; ++I)
-          Operands.push_back(Builder.CreateExtractValue(PassthruOperand, {I}));
+        Operands.push_back(PassthruOperand);
       }
 
       Operands.push_back(Ops[Offset]); // Ptr
@@ -1097,9 +1096,15 @@ multiclass RVVIndexedSegLoadTuple<string op> {
       Operands.push_back(Ops[Offset + 2]); // VL
       if (IsMasked)
         Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
+      Operands.push_back(ConstantInt::get(Ops.back()->getType(), SegInstSEW));
 
-      IntrinsicTypes = {ElementVectorType, Ops[Offset + 1]->getType(),
-                        Ops.back()->getType()};
+      if (IsMasked)
+        IntrinsicTypes = {ResultType, Ops[Offset + 1]->getType(),
+                          Ops[0]->getType(),
+                          Ops.back()->getType()};
+      else
+        IntrinsicTypes = {ResultType, Ops[Offset + 1]->getType(),
+                          Ops.back()->getType()};
       llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
       llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
 
@@ -1139,26 +1144,28 @@ multiclass RVVIndexedSegStoreTuple<string op> {
     {
       // Masked
       // Builtin: (mask, ptr, index, v_tuple, vl)
-      // Intrinsic: (val0, val1, ..., ptr, index, mask, vl)
+      // Intrinsic: (tuple, ptr, index, mask, vl)
       // Unmasked
       // Builtin: (ptr, index, v_tuple, vl)
-      // Intrinsic: (val0, val1, ..., ptr, index, vl)
+      // Intrinsic: (tuple, ptr, index, vl)
       unsigned Offset = IsMasked ? 1 : 0;
-      llvm::Value *VTupleOperand = Ops[Offset + 2];
 
       SmallVector<llvm::Value*, 12> Operands;
-      for (unsigned I = 0; I < NF; ++I) {
-        llvm::Value *V = Builder.CreateExtractValue(VTupleOperand, {I});
-        Operands.push_back(V);
-      }
+      Operands.push_back(Ops[Offset + 2]); // tuple
       Operands.push_back(Ops[Offset]); // Ptr
       Operands.push_back(Ops[Offset + 1]); // Idx
       if (IsMasked)
         Operands.push_back(Ops[0]);
       Operands.push_back(Ops[Offset + 3]); // VL
+      Operands.push_back(ConstantInt::get(Ops.back()->getType(), SegInstSEW));
 
-      IntrinsicTypes = {Operands[0]->getType(), Ops[Offset + 1]->getType(),
-                        Operands.back()->getType()};
+      if (IsMasked)
+        IntrinsicTypes = {Operands[0]->getType(), Ops[Offset + 1]->getType(),
+                          Ops[0]->getType(),
+                          Operands.back()->getType()};
+      else
+        IntrinsicTypes = {Operands[0]->getType(), Ops[Offset + 1]->getType(),
+                          Operands.back()->getType()};
       llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
       return Builder.CreateCall(F, Operands, "");
     }
@@ -2468,22 +2475,25 @@ let HasMasked = false, HasVL = false, IRName = "" in {
   let Name = "vget_v", MaskedPolicyScheme = NonePolicy,
       ManualCodegen = [{
       {
-        if (isa<StructType>(Ops[0]->getType())) // For tuple type
-          // Extract value from index (operand 1) of vtuple (operand 0)
-          return Builder.CreateExtractValue(
-            Ops[0],
-            {(unsigned)cast<ConstantInt>(Ops[1])->getZExtValue()});
         auto *VecTy = cast<ScalableVectorType>(ResultType);
-        auto *OpVecTy = cast<ScalableVectorType>(Ops[0]->getType());
         // Mask to only valid indices.
-        unsigned MaxIndex = OpVecTy->getMinNumElements() / VecTy->getMinNumElements();
-        assert(isPowerOf2_32(MaxIndex));
         Ops[1] = Builder.CreateZExt(Ops[1], Builder.getInt64Ty());
-        Ops[1] = Builder.CreateAnd(Ops[1], MaxIndex - 1);
-        Ops[1] = Builder.CreateMul(Ops[1],
-                                   ConstantInt::get(Ops[1]->getType(),
-                                                    VecTy->getMinNumElements()));
-        return Builder.CreateExtractVector(ResultType, Ops[0], Ops[1]);
+        if (auto *OpVecTy = dyn_cast<ScalableVectorType>(Ops[0]->getType())) {
+          unsigned MaxIndex = OpVecTy->getMinNumElements() / VecTy->getMinNumElements();
+          assert(isPowerOf2_32(MaxIndex));
+          Ops[1] = Builder.CreateAnd(Ops[1], MaxIndex - 1);
+          Ops[1] = Builder.CreateMul(Ops[1],
+                                     ConstantInt::get(Ops[1]->getType(),
+                                                      VecTy->getMinNumElements()));
+          return Builder.CreateExtractVector(ResultType, Ops[0], Ops[1]);
+        }
+
+        bool IsRISCV64 = getTarget().getTriple().isRISCV64();
+        llvm::Type *XLenTy = IsRISCV64 ? Builder.getInt64Ty() :
+                                         Builder.getInt32Ty();
+        return Builder.CreateIntrinsic(Intrinsic::riscv_vector_extract,
+                                       {ResultType, Ops[0]->getType(), XLenTy},
+                                       {Ops[0], Ops[1]});
       }
       }] in {
     foreach dst_lmul = ["(SFixedLog2LMUL:0)", "(SFixedLog2LMUL:1)", "(SFixedLog2LMUL:2)"] in {
@@ -2500,22 +2510,25 @@ let HasMasked = false, HasVL = false, IRName = "" in {
   let Name = "vset_v", MaskedPolicyScheme = NonePolicy,
       ManualCodegen = [{
       {
-        if (isa<StructType>(ResultType)) // For tuple type
-          // Insert value (operand 2) into index (operand 1) of vtuple (operand 0)
-          return Builder.CreateInsertValue(
-            Ops[0], Ops[2],
-            {(unsigned)cast<ConstantInt>(Ops[1])->getZExtValue()});
-        auto *ResVecTy = cast<ScalableVectorType>(ResultType);
         auto *VecTy = cast<ScalableVectorType>(Ops[2]->getType());
         // Mask to only valid indices.
-        unsigned MaxIndex = ResVecTy->getMinNumElements() / VecTy->getMinNumElements();
-        assert(isPowerOf2_32(MaxIndex));
         Ops[1] = Builder.CreateZExt(Ops[1], Builder.getInt64Ty());
-        Ops[1] = Builder.CreateAnd(Ops[1], MaxIndex - 1);
-        Ops[1] = Builder.CreateMul(Ops[1],
-                                   ConstantInt::get(Ops[1]->getType(),
-                                                    VecTy->getMinNumElements()));
-        return Builder.CreateInsertVector(ResultType, Ops[0], Ops[2], Ops[1]);
+        if (auto *ResVecTy = dyn_cast<ScalableVectorType>(ResultType)) {
+          unsigned MaxIndex = ResVecTy->getMinNumElements() / VecTy->getMinNumElements();
+          assert(isPowerOf2_32(MaxIndex));
+          Ops[1] = Builder.CreateAnd(Ops[1], MaxIndex - 1);
+          Ops[1] = Builder.CreateMul(Ops[1],
+                                     ConstantInt::get(Ops[1]->getType(),
+                                                      VecTy->getMinNumElements()));
+          return Builder.CreateInsertVector(ResultType, Ops[0], Ops[2], Ops[1]);
+        }
+
+        bool IsRISCV64 = getTarget().getTriple().isRISCV64();
+        llvm::Type *XLenTy = IsRISCV64 ? Builder.getInt64Ty() :
+                                         Builder.getInt32Ty();
+        return Builder.CreateIntrinsic(Intrinsic::riscv_vector_insert,
+                                       {ResultType, Ops[2]->getType(), XLenTy},
+                                       {Ops[0], Ops[2], Ops[1]});
       }
       }] in {
     foreach dst_lmul = ["(LFixedLog2LMUL:1)", "(LFixedLog2LMUL:2)", "(LFixedLog2LMUL:3)"] in {
@@ -2539,22 +2552,26 @@ let HasMasked = false, HasVL = false, IRName = "" in {
       SupportOverloading = false,
       ManualCodegen = [{
       {
-        if (isa<StructType>(ResultType)) {
-          unsigned NF = cast<StructType>(ResultType)->getNumElements();
-          llvm::Value *ReturnTuple = llvm::PoisonValue::get(ResultType);
-          for (unsigned I = 0; I < NF; ++I) {
-            ReturnTuple = Builder.CreateInsertValue(ReturnTuple, Ops[I], {I});
-          }
-          return ReturnTuple;
-        }
         llvm::Value *ReturnVector = llvm::PoisonValue::get(ResultType);
         auto *VecTy = cast<ScalableVectorType>(Ops[0]->getType());
+        bool IsRISCV64 = getTarget().getTriple().isRISCV64();
+        llvm::Type *XLenTy = IsRISCV64 ? Builder.getInt64Ty() :
+                                         Builder.getInt32Ty();
         for (unsigned I = 0, N = Ops.size(); I < N; ++I) {
           llvm::Value *Idx =
             ConstantInt::get(Builder.getInt64Ty(),
-                              VecTy->getMinNumElements() * I);
-          ReturnVector =
-            Builder.CreateInsertVector(ResultType, ReturnVector, Ops[I], Idx);
+                             ResultType->isScalableTy() ?
+                             VecTy->getMinNumElements() * I : I);
+
+          if (ResultType->isScalableTy())
+            ReturnVector =
+              Builder.CreateInsertVector(ResultType, ReturnVector, Ops[I], Idx);
+          else
+            ReturnVector =
+              Builder.CreateIntrinsic(Intrinsic::riscv_vector_insert,
+                                      {ResultType, Ops[I]->getType(), XLenTy},
+                                      {ReturnVector, Ops[I], Idx});
+
         }
         return ReturnVector;
       }
diff --git a/clang/include/clang/Support/RISCVVIntrinsicUtils.h b/clang/include/clang/Support/RISCVVIntrinsicUtils.h
index 97493bae5656e..3386578904156 100644
--- a/clang/include/clang/Support/RISCVVIntrinsicUtils.h
+++ b/clang/include/clang/Support/RISCVVIntrinsicUtils.h
@@ -429,6 +429,7 @@ class RVVIntrinsic {
   bool hasBuiltinAlias() const { return HasBuiltinAlias; }
   bool hasManualCodegen() const { return !ManualCodegen.empty(); }
   bool isMasked() const { return IsMasked; }
+  llvm::StringRef getOverloadedName() const { return OverloadedName; }
   llvm::StringRef getIRName() const { return IRName; }
   llvm::StringRef getManualCodegen() const { return ManualCodegen; }
   PolicyScheme getPolicyScheme() const { return Scheme; }
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 5b92f1837980c..1c7d1f81e9bcc 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -21751,13 +21751,14 @@ Value *CodeGenFunction::EmitRISCVBuiltinExpr(unsigned BuiltinID,
   }
 
   Intrinsic::ID ID = Intrinsic::not_intrinsic;
-  unsigned NF = 1;
   // The 0th bit simulates the `vta` of RVV
   // The 1st bit simulates the `vma` of RVV
   constexpr unsigned RVV_VTA = 0x1;
   constexpr unsigned RVV_VMA = 0x2;
   int PolicyAttrs = 0;
   bool IsMasked = false;
+  // This is used by segment load/store to determine it's llvm type.
+  unsigned SegInstSEW = 8;
 
   // Required for overloaded intrinsics.
   llvm::SmallVector<llvm::Type *, 2> IntrinsicTypes;
diff --git a/clang/lib/CodeGen/CodeGenTypes.cpp b/clang/lib/CodeGen/CodeGenTypes.cpp
index d823c336e39bf..49f...
[truncated]

@llvmbot
Copy link
Member

llvmbot commented Jul 8, 2024

@llvm/pr-subscribers-backend-risc-v

Author: Brandon Wu (4vtomat)

Changes

Currently we have built-in C types for RISCV vector tuple type, e.g.
vint32m1x2_t, however it's is represented as structure of scalable
vector types, i.e. {&lt;vscale x 2 x i32&gt;, &lt;vscale x 2 x i32&gt;}. It loses
the information for num_fields(NF) as struct is flattened during selection
DAG, thus it makes it not possible to handle inline assembly of vector
tuple type, it also makes the calling convention of vector tuple types
handing not strait forward and hard to realize the allocation code, i.e.
RVVArgDispatcher.

This patch supports RISCV vector tuple types represented as TargetExtType
which contains both LMUL and NF(num_fields) information and keep it all the
way down to selectionDAG to match the corresponding MVT(support in the
following patch). The llvm IR for the example above is then represented
as target("riscv_m1x2", i8, i8, log2(1) + 3, 2) in which the LMUL is
encoded as it's log2 value plus 3 as TargetExtType only accepts unsigned
value so it needs additional offset value.

The new RISCV specific vector insert/extract intrinsics are also added
as llvm.riscv.vector.insert and llvm.riscv.vector.extract to handle
tuple type subvector inserttoin/extraction since the generic ones only
operates on VectorType but not TargetExtType.

There are total of 32 llvm types added for each VREGS * NF &lt;= 8, where
VREGS is the vector registers needed for each LMUL and NF is num_fields.
The name of types are:

riscv_mf8x2, riscv_mf8x3, riscv_mf8x4, riscv_mf8x5, riscv_mf8x6, riscv_mf8x7, riscv_mf8x8,
riscv_mf4x2, riscv_mf4x3, riscv_mf4x4, riscv_mf4x5, riscv_mf4x6, riscv_mf4x7, riscv_mf4x8,
riscv_mf2x2, riscv_mf2x3, riscv_mf2x4, riscv_mf2x5, riscv_mf2x6, riscv_mf2x7, riscv_mf2x8,
riscv_m1x2, riscv_m1x3, riscv_m1x4, riscv_m1x5, riscv_m1x6, riscv_m1x7, riscv_m1x8,
riscv_m2x2, riscv_m2x3, riscv_m2x4,
riscv_m4x2.

Patch is 94.52 MiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/97992.diff

1007 Files Affected:

  • (modified) clang/include/clang/Basic/riscv_vector.td (+107-90)
  • (modified) clang/include/clang/Support/RISCVVIntrinsicUtils.h (+1)
  • (modified) clang/lib/CodeGen/CGBuiltin.cpp (+2-1)
  • (modified) clang/lib/CodeGen/CodeGenTypes.cpp (+18-7)
  • (modified) clang/lib/Support/RISCVVIntrinsicUtils.cpp (+1-1)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vcreate.c (+166-166)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vget.c (+50-50)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vloxseg2ei16.c (+30-30)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vloxseg3ei16.c (+24-24)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vloxseg4ei16.c (+24-24)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vloxseg5ei16.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vloxseg6ei16.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vloxseg7ei16.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vloxseg8ei16.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlseg2e16.c (+30-30)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlseg2e16ff.c (+60-90)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlseg3e16.c (+24-24)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlseg3e16ff.c (+48-88)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlseg4e16.c (+24-24)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlseg4e16ff.c (+48-104)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlseg5e16.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlseg5e16ff.c (+36-90)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlseg6e16.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlseg6e16ff.c (+36-102)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlseg7e16.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlseg7e16ff.c (+36-114)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlseg8e16.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlseg8e16ff.c (+36-126)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlsseg2e16.c (+30-30)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlsseg3e16.c (+24-24)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlsseg4e16.c (+24-24)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlsseg5e16.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlsseg6e16.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlsseg7e16.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vlsseg8e16.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vluxseg2ei16.c (+30-30)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vluxseg3ei16.c (+24-24)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vluxseg4ei16.c (+24-24)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vluxseg5ei16.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vluxseg6ei16.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vluxseg7ei16.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vluxseg8ei16.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vset.c (+100-100)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsoxseg2ei16.c (+20-40)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsoxseg3ei16.c (+16-40)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsoxseg4ei16.c (+16-48)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsoxseg5ei16.c (+12-42)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsoxseg6ei16.c (+12-48)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsoxseg7ei16.c (+12-54)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsoxseg8ei16.c (+12-60)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsseg2e16.c (+20-40)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsseg3e16.c (+16-40)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsseg4e16.c (+16-48)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsseg5e16.c (+12-42)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsseg6e16.c (+12-48)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsseg7e16.c (+12-54)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsseg8e16.c (+12-60)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vssseg2e16.c (+20-40)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vssseg3e16.c (+16-40)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vssseg4e16.c (+16-48)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vssseg5e16.c (+12-42)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vssseg6e16.c (+12-48)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vssseg7e16.c (+12-54)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vssseg8e16.c (+12-60)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsuxseg2ei16.c (+20-40)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsuxseg3ei16.c (+16-40)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsuxseg4ei16.c (+16-48)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsuxseg5ei16.c (+12-42)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsuxseg6ei16.c (+12-48)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsuxseg7ei16.c (+12-54)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vsuxseg8ei16.c (+12-60)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/bfloat16/vundefined.c (+50-50)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vcreate.c (+1483-1483)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vget.c (+452-452)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg2ei16.c (+288-288)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg2ei32.c (+276-276)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg2ei64.c (+246-246)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg2ei8.c (+288-288)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg3ei16.c (+222-222)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg3ei32.c (+222-222)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg3ei64.c (+210-210)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg3ei8.c (+222-222)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg4ei16.c (+222-222)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg4ei32.c (+222-222)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg4ei64.c (+210-210)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg4ei8.c (+222-222)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg5ei16.c (+156-156)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg5ei32.c (+156-156)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg5ei64.c (+156-156)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg5ei8.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg6ei16.c (+156-156)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg6ei32.c (+156-156)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg6ei64.c (+156-156)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg6ei8.c (+156-156)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg7ei16.c (+156-156)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg7ei32.c (+156-156)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg7ei64.c (+156-156)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg7ei8.c (+156-156)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg8ei16.c (+156-156)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg8ei32.c (+156-156)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg8ei64.c (+156-156)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg8ei8.c (+156-156)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e16.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e16ff.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e32.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e32ff.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e64.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e64ff.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e8.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e8ff.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg3e16.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg3e16ff.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg3e32.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg3e32ff.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg3e64.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg3e64ff.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg3e8.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg3e8ff.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg4e16.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg4e16ff.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg4e32.c (+54-54)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg4e32ff.c (+108-234)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg4e64.c (+36-36)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg4e64ff.c (+72-156)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg4e8.c (+60-60)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg4e8ff.c (+120-260)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg5e16.c (+54-54)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg5e16ff.c (+108-270)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg5e32.c (+36-36)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg5e32ff.c (+72-180)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg5e64.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg5e64ff.c (+36-90)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg5e8.c (+48-48)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg5e8ff.c (+96-240)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg6e16.c (+54-54)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg6e16ff.c (+108-306)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg6e32.c (+36-36)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg6e32ff.c (+72-204)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg6e64.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg6e64ff.c (+36-102)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg6e8.c (+48-48)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg6e8ff.c (+96-272)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg7e16.c (+54-54)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg7e16ff.c (+108-342)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg7e32.c (+36-36)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg7e32ff.c (+72-228)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg7e64.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg7e64ff.c (+36-114)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg7e8.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg7e8ff.c ()
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg8e16.c (+54-54)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg8e16ff.c (+108-378)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg8e32.c (+36-36)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg8e32ff.c (+72-252)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg8e64.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg8e64ff.c (+36-126)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg8e8.c (+48-48)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg8e8ff.c (+96-336)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg2e16.c (+90-90)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg2e32.c (+72-72)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg2e64.c (+54-54)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg2e8.c (+72-72)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg3e16.c (+72-72)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg3e32.c (+54-54)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg3e64.c (+36-36)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg3e8.c (+60-60)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg4e16.c (+72-72)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg4e32.c (+54-54)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg4e64.c (+36-36)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg4e8.c (+60-60)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg5e16.c (+54-54)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg5e32.c (+36-36)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg5e64.c (+18-18)
  • (modified) clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg5e8.c (+48-48)
diff --git a/clang/include/clang/Basic/riscv_vector.td b/clang/include/clang/Basic/riscv_vector.td
index a0820e2093bc2..67f480dec0fe3 100644
--- a/clang/include/clang/Basic/riscv_vector.td
+++ b/clang/include/clang/Basic/riscv_vector.td
@@ -762,8 +762,10 @@ multiclass RVVUnitStridedSegLoadTuple<string op> {
                                                    []<string>)),
             ManualCodegen = [{
     {
-      llvm::Type *ElementVectorType = cast<StructType>(ResultType)->elements()[0];
-      IntrinsicTypes = {ElementVectorType, Ops.back()->getType()};
+      if (IsMasked)
+        IntrinsicTypes = {ResultType, Ops[0]->getType(), Ops.back()->getType()};
+      else
+        IntrinsicTypes = {ResultType, Ops.back()->getType()};
       SmallVector<llvm::Value*, 12> Operands;
 
       bool NoPassthru =
@@ -772,11 +774,10 @@ multiclass RVVUnitStridedSegLoadTuple<string op> {
       unsigned Offset = IsMasked ? NoPassthru ? 1 : 2 : NoPassthru ? 0 : 1;
 
       if (NoPassthru) { // Push poison into passthru
-        Operands.append(NF, llvm::PoisonValue::get(ElementVectorType));
+        Operands.push_back(llvm::PoisonValue::get(ResultType));
       } else { // Push intrinsics operands into passthru
         llvm::Value *PassthruOperand = IsMasked ? Ops[1] : Ops[0];
-        for (unsigned I = 0; I < NF; ++I)
-          Operands.push_back(Builder.CreateExtractValue(PassthruOperand, {I}));
+        Operands.push_back(PassthruOperand);
       }
 
       Operands.push_back(Ops[Offset]); // Ptr
@@ -785,6 +786,7 @@ multiclass RVVUnitStridedSegLoadTuple<string op> {
       Operands.push_back(Ops[Offset + 1]); // VL
       if (IsMasked)
         Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
+      Operands.push_back(ConstantInt::get(Ops.back()->getType(), SegInstSEW));
 
       llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
 
@@ -828,24 +830,24 @@ multiclass RVVUnitStridedSegStoreTuple<string op> {
     {
       // Masked
       // Builtin: (mask, ptr, v_tuple, vl)
-      // Intrinsic: (val0, val1, ..., ptr, mask, vl)
+      // Intrinsic: (tuple, ptr, mask, vl)
       // Unmasked
       // Builtin: (ptr, v_tuple, vl)
-      // Intrinsic: (val0, val1, ..., ptr, vl)
+      // Intrinsic: (tuple, ptr, vl)
       unsigned Offset = IsMasked ? 1 : 0;
-      llvm::Value *VTupleOperand = Ops[Offset + 1];
 
       SmallVector<llvm::Value*, 12> Operands;
-      for (unsigned I = 0; I < NF; ++I) {
-        llvm::Value *V = Builder.CreateExtractValue(VTupleOperand, {I});
-        Operands.push_back(V);
-      }
+      Operands.push_back(Ops[Offset + 1]); // tuple
       Operands.push_back(Ops[Offset]); // Ptr
       if (IsMasked)
         Operands.push_back(Ops[0]);
       Operands.push_back(Ops[Offset + 2]); // VL
+      Operands.push_back(ConstantInt::get(Ops.back()->getType(), SegInstSEW));
 
-      IntrinsicTypes = {Operands[0]->getType(), Operands.back()->getType()};
+      if (IsMasked)
+        IntrinsicTypes = {Operands[0]->getType(), Ops[0]->getType(), Operands.back()->getType()};
+      else
+        IntrinsicTypes = {Operands[0]->getType(), Operands.back()->getType()};
       llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
       return Builder.CreateCall(F, Operands, "");
    }
@@ -880,8 +882,10 @@ multiclass RVVUnitStridedSegLoadFFTuple<string op> {
                                                    []<string>)),
             ManualCodegen = [{
     {
-      llvm::Type *ElementVectorType = cast<StructType>(ResultType)->elements()[0];
-      IntrinsicTypes = {ElementVectorType, Ops.back()->getType()};
+      if (IsMasked)
+        IntrinsicTypes = {ResultType, Ops.back()->getType(), Ops[0]->getType()};
+      else
+        IntrinsicTypes = {ResultType, Ops.back()->getType()};
       SmallVector<llvm::Value*, 12> Operands;
 
       bool NoPassthru =
@@ -890,11 +894,10 @@ multiclass RVVUnitStridedSegLoadFFTuple<string op> {
       unsigned Offset = IsMasked ? NoPassthru ? 1 : 2 : NoPassthru ? 0 : 1;
 
       if (NoPassthru) { // Push poison into passthru
-        Operands.append(NF, llvm::PoisonValue::get(ElementVectorType));
+        Operands.push_back(llvm::PoisonValue::get(ResultType));
       } else { // Push intrinsics operands into passthru
         llvm::Value *PassthruOperand = IsMasked ? Ops[1] : Ops[0];
-        for (unsigned I = 0; I < NF; ++I)
-          Operands.push_back(Builder.CreateExtractValue(PassthruOperand, {I}));
+        Operands.push_back(PassthruOperand);
       }
 
       Operands.push_back(Ops[Offset]); // Ptr
@@ -903,6 +906,7 @@ multiclass RVVUnitStridedSegLoadFFTuple<string op> {
       Operands.push_back(Ops[Offset + 2]); // vl
       if (IsMasked)
         Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
+      Operands.push_back(ConstantInt::get(Ops.back()->getType(), SegInstSEW));
 
       llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
 
@@ -911,14 +915,10 @@ multiclass RVVUnitStridedSegLoadFFTuple<string op> {
       clang::CharUnits Align =
           CGM.getNaturalPointeeTypeAlignment(E->getArg(Offset + 1)->getType());
 
-      llvm::Value *ReturnTuple = llvm::PoisonValue::get(ResultType);
-      for (unsigned I = 0; I < NF; ++I) {
-        llvm::Value *V = Builder.CreateExtractValue(LoadValue, {I});
-        ReturnTuple = Builder.CreateInsertValue(ReturnTuple, V, {I});
-      }
+      llvm::Value *ReturnTuple = Builder.CreateExtractValue(LoadValue, 0);
 
       // Store new_vl
-      llvm::Value *V = Builder.CreateExtractValue(LoadValue, {NF});
+      llvm::Value *V = Builder.CreateExtractValue(LoadValue, 1);
       Builder.CreateStore(V, Address(Ops[Offset + 1], V->getType(), Align));
 
       if (ReturnValue.isNull())
@@ -957,8 +957,10 @@ multiclass RVVStridedSegLoadTuple<string op> {
                                                    []<string>)),
             ManualCodegen = [{
     {
-      llvm::Type *ElementVectorType = cast<StructType>(ResultType)->elements()[0];
-      IntrinsicTypes = {ElementVectorType, Ops.back()->getType()};
+      if (IsMasked)
+        IntrinsicTypes = {ResultType, Ops.back()->getType(), Ops[0]->getType()};
+      else
+        IntrinsicTypes = {ResultType, Ops.back()->getType()};
       SmallVector<llvm::Value*, 12> Operands;
 
       bool NoPassthru =
@@ -967,11 +969,10 @@ multiclass RVVStridedSegLoadTuple<string op> {
       unsigned Offset = IsMasked ? NoPassthru ? 1 : 2 : NoPassthru ? 0 : 1;
 
       if (NoPassthru) { // Push poison into passthru
-        Operands.append(NF, llvm::PoisonValue::get(ElementVectorType));
+        Operands.push_back(llvm::PoisonValue::get(ResultType));
       } else { // Push intrinsics operands into passthru
         llvm::Value *PassthruOperand = IsMasked ? Ops[1] : Ops[0];
-        for (unsigned I = 0; I < NF; ++I)
-          Operands.push_back(Builder.CreateExtractValue(PassthruOperand, {I}));
+        Operands.push_back(PassthruOperand);
       }
 
       Operands.push_back(Ops[Offset]); // Ptr
@@ -981,6 +982,7 @@ multiclass RVVStridedSegLoadTuple<string op> {
       Operands.push_back(Ops[Offset + 2]); // VL
       if (IsMasked)
         Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
+      Operands.push_back(ConstantInt::get(Ops.back()->getType(), SegInstSEW));
 
       llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
       llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
@@ -1025,25 +1027,25 @@ multiclass RVVStridedSegStoreTuple<string op> {
     {
       // Masked
       // Builtin: (mask, ptr, stride, v_tuple, vl)
-      // Intrinsic: (val0, val1, ..., ptr, stride, mask, vl)
+      // Intrinsic: (tuple, ptr, stride, mask, vl)
       // Unmasked
       // Builtin: (ptr, stride, v_tuple, vl)
-      // Intrinsic: (val0, val1, ..., ptr, stride, vl)
+      // Intrinsic: (tuple, ptr, stride, vl)
       unsigned Offset = IsMasked ? 1 : 0;
-      llvm::Value *VTupleOperand = Ops[Offset + 2];
 
       SmallVector<llvm::Value*, 12> Operands;
-      for (unsigned I = 0; I < NF; ++I) {
-        llvm::Value *V = Builder.CreateExtractValue(VTupleOperand, {I});
-        Operands.push_back(V);
-      }
+      Operands.push_back(Ops[Offset + 2]); // tuple
       Operands.push_back(Ops[Offset]); // Ptr
       Operands.push_back(Ops[Offset + 1]); // Stride
       if (IsMasked)
         Operands.push_back(Ops[0]);
       Operands.push_back(Ops[Offset + 3]); // VL
+      Operands.push_back(ConstantInt::get(Ops.back()->getType(), SegInstSEW));
 
-      IntrinsicTypes = {Operands[0]->getType(), Operands.back()->getType()};
+      if (IsMasked)
+        IntrinsicTypes = {Operands[0]->getType(), Operands.back()->getType(), Ops[0]->getType()};
+      else
+        IntrinsicTypes = {Operands[0]->getType(), Operands.back()->getType()};
       llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
       return Builder.CreateCall(F, Operands, "");
     }
@@ -1073,8 +1075,6 @@ multiclass RVVIndexedSegLoadTuple<string op> {
                                                    []<string>)),
             ManualCodegen = [{
     {
-      llvm::Type *ElementVectorType = cast<StructType>(ResultType)->elements()[0];
-      IntrinsicTypes = {ElementVectorType, Ops.back()->getType()};
       SmallVector<llvm::Value*, 12> Operands;
 
       bool NoPassthru =
@@ -1083,11 +1083,10 @@ multiclass RVVIndexedSegLoadTuple<string op> {
       unsigned Offset = IsMasked ? NoPassthru ? 1 : 2 : NoPassthru ? 0 : 1;
 
       if (NoPassthru) { // Push poison into passthru
-        Operands.append(NF, llvm::PoisonValue::get(ElementVectorType));
+        Operands.push_back(llvm::PoisonValue::get(ResultType));
       } else { // Push intrinsics operands into passthru
         llvm::Value *PassthruOperand = IsMasked ? Ops[1] : Ops[0];
-        for (unsigned I = 0; I < NF; ++I)
-          Operands.push_back(Builder.CreateExtractValue(PassthruOperand, {I}));
+        Operands.push_back(PassthruOperand);
       }
 
       Operands.push_back(Ops[Offset]); // Ptr
@@ -1097,9 +1096,15 @@ multiclass RVVIndexedSegLoadTuple<string op> {
       Operands.push_back(Ops[Offset + 2]); // VL
       if (IsMasked)
         Operands.push_back(ConstantInt::get(Ops.back()->getType(), PolicyAttrs));
+      Operands.push_back(ConstantInt::get(Ops.back()->getType(), SegInstSEW));
 
-      IntrinsicTypes = {ElementVectorType, Ops[Offset + 1]->getType(),
-                        Ops.back()->getType()};
+      if (IsMasked)
+        IntrinsicTypes = {ResultType, Ops[Offset + 1]->getType(),
+                          Ops[0]->getType(),
+                          Ops.back()->getType()};
+      else
+        IntrinsicTypes = {ResultType, Ops[Offset + 1]->getType(),
+                          Ops.back()->getType()};
       llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
       llvm::Value *LoadValue = Builder.CreateCall(F, Operands, "");
 
@@ -1139,26 +1144,28 @@ multiclass RVVIndexedSegStoreTuple<string op> {
     {
       // Masked
       // Builtin: (mask, ptr, index, v_tuple, vl)
-      // Intrinsic: (val0, val1, ..., ptr, index, mask, vl)
+      // Intrinsic: (tuple, ptr, index, mask, vl)
       // Unmasked
       // Builtin: (ptr, index, v_tuple, vl)
-      // Intrinsic: (val0, val1, ..., ptr, index, vl)
+      // Intrinsic: (tuple, ptr, index, vl)
       unsigned Offset = IsMasked ? 1 : 0;
-      llvm::Value *VTupleOperand = Ops[Offset + 2];
 
       SmallVector<llvm::Value*, 12> Operands;
-      for (unsigned I = 0; I < NF; ++I) {
-        llvm::Value *V = Builder.CreateExtractValue(VTupleOperand, {I});
-        Operands.push_back(V);
-      }
+      Operands.push_back(Ops[Offset + 2]); // tuple
       Operands.push_back(Ops[Offset]); // Ptr
       Operands.push_back(Ops[Offset + 1]); // Idx
       if (IsMasked)
         Operands.push_back(Ops[0]);
       Operands.push_back(Ops[Offset + 3]); // VL
+      Operands.push_back(ConstantInt::get(Ops.back()->getType(), SegInstSEW));
 
-      IntrinsicTypes = {Operands[0]->getType(), Ops[Offset + 1]->getType(),
-                        Operands.back()->getType()};
+      if (IsMasked)
+        IntrinsicTypes = {Operands[0]->getType(), Ops[Offset + 1]->getType(),
+                          Ops[0]->getType(),
+                          Operands.back()->getType()};
+      else
+        IntrinsicTypes = {Operands[0]->getType(), Ops[Offset + 1]->getType(),
+                          Operands.back()->getType()};
       llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
       return Builder.CreateCall(F, Operands, "");
     }
@@ -2468,22 +2475,25 @@ let HasMasked = false, HasVL = false, IRName = "" in {
   let Name = "vget_v", MaskedPolicyScheme = NonePolicy,
       ManualCodegen = [{
       {
-        if (isa<StructType>(Ops[0]->getType())) // For tuple type
-          // Extract value from index (operand 1) of vtuple (operand 0)
-          return Builder.CreateExtractValue(
-            Ops[0],
-            {(unsigned)cast<ConstantInt>(Ops[1])->getZExtValue()});
         auto *VecTy = cast<ScalableVectorType>(ResultType);
-        auto *OpVecTy = cast<ScalableVectorType>(Ops[0]->getType());
         // Mask to only valid indices.
-        unsigned MaxIndex = OpVecTy->getMinNumElements() / VecTy->getMinNumElements();
-        assert(isPowerOf2_32(MaxIndex));
         Ops[1] = Builder.CreateZExt(Ops[1], Builder.getInt64Ty());
-        Ops[1] = Builder.CreateAnd(Ops[1], MaxIndex - 1);
-        Ops[1] = Builder.CreateMul(Ops[1],
-                                   ConstantInt::get(Ops[1]->getType(),
-                                                    VecTy->getMinNumElements()));
-        return Builder.CreateExtractVector(ResultType, Ops[0], Ops[1]);
+        if (auto *OpVecTy = dyn_cast<ScalableVectorType>(Ops[0]->getType())) {
+          unsigned MaxIndex = OpVecTy->getMinNumElements() / VecTy->getMinNumElements();
+          assert(isPowerOf2_32(MaxIndex));
+          Ops[1] = Builder.CreateAnd(Ops[1], MaxIndex - 1);
+          Ops[1] = Builder.CreateMul(Ops[1],
+                                     ConstantInt::get(Ops[1]->getType(),
+                                                      VecTy->getMinNumElements()));
+          return Builder.CreateExtractVector(ResultType, Ops[0], Ops[1]);
+        }
+
+        bool IsRISCV64 = getTarget().getTriple().isRISCV64();
+        llvm::Type *XLenTy = IsRISCV64 ? Builder.getInt64Ty() :
+                                         Builder.getInt32Ty();
+        return Builder.CreateIntrinsic(Intrinsic::riscv_vector_extract,
+                                       {ResultType, Ops[0]->getType(), XLenTy},
+                                       {Ops[0], Ops[1]});
       }
       }] in {
     foreach dst_lmul = ["(SFixedLog2LMUL:0)", "(SFixedLog2LMUL:1)", "(SFixedLog2LMUL:2)"] in {
@@ -2500,22 +2510,25 @@ let HasMasked = false, HasVL = false, IRName = "" in {
   let Name = "vset_v", MaskedPolicyScheme = NonePolicy,
       ManualCodegen = [{
       {
-        if (isa<StructType>(ResultType)) // For tuple type
-          // Insert value (operand 2) into index (operand 1) of vtuple (operand 0)
-          return Builder.CreateInsertValue(
-            Ops[0], Ops[2],
-            {(unsigned)cast<ConstantInt>(Ops[1])->getZExtValue()});
-        auto *ResVecTy = cast<ScalableVectorType>(ResultType);
         auto *VecTy = cast<ScalableVectorType>(Ops[2]->getType());
         // Mask to only valid indices.
-        unsigned MaxIndex = ResVecTy->getMinNumElements() / VecTy->getMinNumElements();
-        assert(isPowerOf2_32(MaxIndex));
         Ops[1] = Builder.CreateZExt(Ops[1], Builder.getInt64Ty());
-        Ops[1] = Builder.CreateAnd(Ops[1], MaxIndex - 1);
-        Ops[1] = Builder.CreateMul(Ops[1],
-                                   ConstantInt::get(Ops[1]->getType(),
-                                                    VecTy->getMinNumElements()));
-        return Builder.CreateInsertVector(ResultType, Ops[0], Ops[2], Ops[1]);
+        if (auto *ResVecTy = dyn_cast<ScalableVectorType>(ResultType)) {
+          unsigned MaxIndex = ResVecTy->getMinNumElements() / VecTy->getMinNumElements();
+          assert(isPowerOf2_32(MaxIndex));
+          Ops[1] = Builder.CreateAnd(Ops[1], MaxIndex - 1);
+          Ops[1] = Builder.CreateMul(Ops[1],
+                                     ConstantInt::get(Ops[1]->getType(),
+                                                      VecTy->getMinNumElements()));
+          return Builder.CreateInsertVector(ResultType, Ops[0], Ops[2], Ops[1]);
+        }
+
+        bool IsRISCV64 = getTarget().getTriple().isRISCV64();
+        llvm::Type *XLenTy = IsRISCV64 ? Builder.getInt64Ty() :
+                                         Builder.getInt32Ty();
+        return Builder.CreateIntrinsic(Intrinsic::riscv_vector_insert,
+                                       {ResultType, Ops[2]->getType(), XLenTy},
+                                       {Ops[0], Ops[2], Ops[1]});
       }
       }] in {
     foreach dst_lmul = ["(LFixedLog2LMUL:1)", "(LFixedLog2LMUL:2)", "(LFixedLog2LMUL:3)"] in {
@@ -2539,22 +2552,26 @@ let HasMasked = false, HasVL = false, IRName = "" in {
       SupportOverloading = false,
       ManualCodegen = [{
       {
-        if (isa<StructType>(ResultType)) {
-          unsigned NF = cast<StructType>(ResultType)->getNumElements();
-          llvm::Value *ReturnTuple = llvm::PoisonValue::get(ResultType);
-          for (unsigned I = 0; I < NF; ++I) {
-            ReturnTuple = Builder.CreateInsertValue(ReturnTuple, Ops[I], {I});
-          }
-          return ReturnTuple;
-        }
         llvm::Value *ReturnVector = llvm::PoisonValue::get(ResultType);
         auto *VecTy = cast<ScalableVectorType>(Ops[0]->getType());
+        bool IsRISCV64 = getTarget().getTriple().isRISCV64();
+        llvm::Type *XLenTy = IsRISCV64 ? Builder.getInt64Ty() :
+                                         Builder.getInt32Ty();
         for (unsigned I = 0, N = Ops.size(); I < N; ++I) {
           llvm::Value *Idx =
             ConstantInt::get(Builder.getInt64Ty(),
-                              VecTy->getMinNumElements() * I);
-          ReturnVector =
-            Builder.CreateInsertVector(ResultType, ReturnVector, Ops[I], Idx);
+                             ResultType->isScalableTy() ?
+                             VecTy->getMinNumElements() * I : I);
+
+          if (ResultType->isScalableTy())
+            ReturnVector =
+              Builder.CreateInsertVector(ResultType, ReturnVector, Ops[I], Idx);
+          else
+            ReturnVector =
+              Builder.CreateIntrinsic(Intrinsic::riscv_vector_insert,
+                                      {ResultType, Ops[I]->getType(), XLenTy},
+                                      {ReturnVector, Ops[I], Idx});
+
         }
         return ReturnVector;
       }
diff --git a/clang/include/clang/Support/RISCVVIntrinsicUtils.h b/clang/include/clang/Support/RISCVVIntrinsicUtils.h
index 97493bae5656e..3386578904156 100644
--- a/clang/include/clang/Support/RISCVVIntrinsicUtils.h
+++ b/clang/include/clang/Support/RISCVVIntrinsicUtils.h
@@ -429,6 +429,7 @@ class RVVIntrinsic {
   bool hasBuiltinAlias() const { return HasBuiltinAlias; }
   bool hasManualCodegen() const { return !ManualCodegen.empty(); }
   bool isMasked() const { return IsMasked; }
+  llvm::StringRef getOverloadedName() const { return OverloadedName; }
   llvm::StringRef getIRName() const { return IRName; }
   llvm::StringRef getManualCodegen() const { return ManualCodegen; }
   PolicyScheme getPolicyScheme() const { return Scheme; }
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 5b92f1837980c..1c7d1f81e9bcc 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -21751,13 +21751,14 @@ Value *CodeGenFunction::EmitRISCVBuiltinExpr(unsigned BuiltinID,
   }
 
   Intrinsic::ID ID = Intrinsic::not_intrinsic;
-  unsigned NF = 1;
   // The 0th bit simulates the `vta` of RVV
   // The 1st bit simulates the `vma` of RVV
   constexpr unsigned RVV_VTA = 0x1;
   constexpr unsigned RVV_VMA = 0x2;
   int PolicyAttrs = 0;
   bool IsMasked = false;
+  // This is used by segment load/store to determine it's llvm type.
+  unsigned SegInstSEW = 8;
 
   // Required for overloaded intrinsics.
   llvm::SmallVector<llvm::Type *, 2> IntrinsicTypes;
diff --git a/clang/lib/CodeGen/CodeGenTypes.cpp b/clang/lib/CodeGen/CodeGenTypes.cpp
index d823c336e39bf..49f...
[truncated]

Copy link

github-actions bot commented Jul 8, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

Copy link
Contributor

@wangpc-pp wangpc-pp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Great work!
I haven't taken a detailed look, but I think we need a summary for these patches or it's too hard to review.

@4vtomat 4vtomat force-pushed the model_tuple_type_as_llvm_type_part1_target_ext_part1 branch 2 times, most recently from b784939 to aee072c Compare July 8, 2024 14:24
@4vtomat
Copy link
Member Author

4vtomat commented Jul 8, 2024

Thanks! Great work!
I haven't taken a detailed look, but I think we need a summary for these patches or it's too hard to review.

Updated! Thanks!

@4vtomat 4vtomat force-pushed the model_tuple_type_as_llvm_type_part1_target_ext_part1 branch from 707b0b6 to d431547 Compare July 18, 2024 07:10
@4vtomat
Copy link
Member Author

4vtomat commented Jul 18, 2024

Update and rebase

@4vtomat
Copy link
Member Author

4vtomat commented Jul 30, 2024

ping~

@topperc
Copy link
Collaborator

topperc commented Jul 30, 2024

ping~

Is this patch commitable by itself or does it depend on the MVT support from part2?

@4vtomat
Copy link
Member Author

4vtomat commented Jul 30, 2024

ping~

Is this patch commitable by itself or does it depend on the MVT support from part2?

No, it's not commitable by itself, all 4 parts should be committed together, so I won't merge it until 4 patches are accepted.

Copy link
Collaborator

@topperc topperc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Currently we have built-in C types for RISCV vector tuple type, e.g.
`vint32m1x2_t`, however it's is represented as structure of scalable
vector types, i.e. `{<vscale x 2 x i32>, <vscale x 2 x i32>}`. It loses
the information for num_fields(NF) as struct is flattened during selection
DAG, thus it makes it not possible to handle inline assembly of vector
tuple type, it also makes the calling convention of vector tuple types
handing not strait forward and hard to realize the allocation code, i.e.
`RVVArgDispatcher`.

This patch supports RISCV vector tuple types represented as `TargetExtType`
which contains both `LMUL` and `NF`(num_fields) information and keep it all the
way down to `selectionDAG` to match the corresponding `MVT`(support in the
following patch). The llvm IR for the example above is then represented
as `target("riscv.vector.tuple", <vscale x 8 x i8>, 2)` in which the first
type parameter is the equivalent size scalable vecotr of i8 element type,
the following integer parameter is the `NF` of the tuple.

The new RISCV specific vector insert/extract intrinsics are also added
as `llvm.riscv.tuple.insert` and `llvm.riscv.tuple.extract` to handle
tuple type subvector inserttoin/extraction since the generic ones only
operates on `VectorType` but not `TargetExtType`.

There are total of 32 llvm types added for each `VREGS * NF <= 8`, where
`VREGS` is the vector registers needed for each `LMUL` and `NF` is num_fields.
The name of types are:
```
target("riscv.vector.tuple", <vscale x 1 x i8>, 2)  // LMUL = mf8, NF = 2
target("riscv.vector.tuple", <vscale x 1 x i8>, 3)  // LMUL = mf8, NF = 3
target("riscv.vector.tuple", <vscale x 1 x i8>, 4)  // LMUL = mf8, NF = 4
target("riscv.vector.tuple", <vscale x 1 x i8>, 5)  // LMUL = mf8, NF = 5
target("riscv.vector.tuple", <vscale x 1 x i8>, 6)  // LMUL = mf8, NF = 6
target("riscv.vector.tuple", <vscale x 1 x i8>, 7)  // LMUL = mf8, NF = 7
target("riscv.vector.tuple", <vscale x 1 x i8>, 8)  // LMUL = mf8, NF = 8
target("riscv.vector.tuple", <vscale x 2 x i8>, 2)  // LMUL = mf4, NF = 2
target("riscv.vector.tuple", <vscale x 2 x i8>, 3)  // LMUL = mf4, NF = 3
target("riscv.vector.tuple", <vscale x 2 x i8>, 4)  // LMUL = mf4, NF = 4
target("riscv.vector.tuple", <vscale x 2 x i8>, 5)  // LMUL = mf4, NF = 5
target("riscv.vector.tuple", <vscale x 2 x i8>, 6)  // LMUL = mf4, NF = 6
target("riscv.vector.tuple", <vscale x 2 x i8>, 7)  // LMUL = mf4, NF = 7
target("riscv.vector.tuple", <vscale x 2 x i8>, 8)  // LMUL = mf4, NF = 8
target("riscv.vector.tuple", <vscale x 4 x i8>, 2)  // LMUL = mf2, NF = 2
target("riscv.vector.tuple", <vscale x 4 x i8>, 3)  // LMUL = mf2, NF = 3
target("riscv.vector.tuple", <vscale x 4 x i8>, 4)  // LMUL = mf2, NF = 4
target("riscv.vector.tuple", <vscale x 4 x i8>, 5)  // LMUL = mf2, NF = 5
target("riscv.vector.tuple", <vscale x 4 x i8>, 6)  // LMUL = mf2, NF = 6
target("riscv.vector.tuple", <vscale x 4 x i8>, 7)  // LMUL = mf2, NF = 7
target("riscv.vector.tuple", <vscale x 4 x i8>, 8)  // LMUL = mf2, NF = 8
target("riscv.vector.tuple", <vscale x 8 x i8>, 2)  // LMUL = m1, NF = 2
target("riscv.vector.tuple", <vscale x 8 x i8>, 3)  // LMUL = m1, NF = 3
target("riscv.vector.tuple", <vscale x 8 x i8>, 4)  // LMUL = m1, NF = 4
target("riscv.vector.tuple", <vscale x 8 x i8>, 5)  // LMUL = m1, NF = 5
target("riscv.vector.tuple", <vscale x 8 x i8>, 6)  // LMUL = m1, NF = 6
target("riscv.vector.tuple", <vscale x 8 x i8>, 7)  // LMUL = m1, NF = 7
target("riscv.vector.tuple", <vscale x 8 x i8>, 8)  // LMUL = m1, NF = 8
target("riscv.vector.tuple", <vscale x 16 x i8>, 2) // LMUL = m2, NF = 2
target("riscv.vector.tuple", <vscale x 16 x i8>, 3) // LMUL = m2, NF = 3
target("riscv.vector.tuple", <vscale x 16 x i8>, 4) // LMUL = m2, NF = 4
target("riscv.vector.tuple", <vscale x 32 x i8>, 2) // LMUL = m4, NF = 2
```
@4vtomat 4vtomat force-pushed the model_tuple_type_as_llvm_type_part1_target_ext_part1 branch from a47cff1 to 989ac51 Compare August 23, 2024 15:45
@4vtomat 4vtomat force-pushed the model_tuple_type_as_llvm_type_part1_target_ext_part1 branch from 989ac51 to 2a03012 Compare August 23, 2024 16:04
@4vtomat 4vtomat merged commit 239127d into llvm:main Aug 31, 2024
5 of 8 checks passed
@4vtomat 4vtomat deleted the model_tuple_type_as_llvm_type_part1_target_ext_part1 branch August 31, 2024 10:59
4vtomat added a commit that referenced this pull request Aug 31, 2024
Summary:
This patch handles the types(MVT) in `selectionDAG` for RISCV vector
tuples.
As described in previous patch handling llvm types, the MVTs also have
32 variants:
```
riscv_nxv1i8x2, riscv_nxv1i8x3, riscv_nxv1i8x4, riscv_nxv1i8x5, riscv_nxv1i8x6, riscv_nxv1i8x7, riscv_nxv1i8x8,
riscv_nxv2i8x2, riscv_nxv2i8x3, riscv_nxv2i8x4, riscv_nxv2i8x5, riscv_nxv2i8x6, riscv_nxv2i8x7, riscv_nxv2i8x8,
riscv_nxv4i8x2, riscv_nxv4i8x3, riscv_nxv4i8x4, riscv_nxv4i8x5, riscv_nxv4i8x6, riscv_nxv4i8x7, riscv_nxv4i8x8,
riscv_nxv8i8x2, riscv_nxv8i8x3, riscv_nxv8i8x4, riscv_nxv8i8x5, riscv_nxv8i8x6, riscv_nxv8i8x7, riscv_nxv8i8x8,
riscv_nxv16i8x2, riscv_nxv16i8x3, riscv_nxv16i8x4,
riscv_nxv32i8x2.
```

Detail:
An intuitive way to model vector tuple type is using nested scalable
vector, e.g. `nElts=NF, EltTy=nxv2i32`. However it's not compatible to
what we've done to handle scalable vector in TargetLowering, so it would
need more effort to change the code to handle this concept.
Another approach is encoding the `MinNumElts` info in `sz` of `MVT`,
e.g.
`nElts=NF, sz=(NF*MinNumElts*8)`, this makes it much easier to handle
and
changes less code.

This patch adopts the latter approach.

Stacked on #97992
@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 31, 2024

LLVM Buildbot has detected a new failure on builder ml-opt-rel-x86-64 running on ml-opt-rel-x86-64-b2 while building clang,llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/185/builds/4389

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: CodeGen/RISCV/early-clobber-tied-def-subreg-liveness.ll' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 2: /b/ml-opt-rel-x86-64-b1/build/bin/llc -O2 -mtriple riscv64 -mattr=+v,+m,+zbb -enable-subreg-liveness      -verify-machineinstrs < /b/ml-opt-rel-x86-64-b1/llvm-project/llvm/test/CodeGen/RISCV/early-clobber-tied-def-subreg-liveness.ll      | /b/ml-opt-rel-x86-64-b1/build/bin/FileCheck /b/ml-opt-rel-x86-64-b1/llvm-project/llvm/test/CodeGen/RISCV/early-clobber-tied-def-subreg-liveness.ll
+ /b/ml-opt-rel-x86-64-b1/build/bin/FileCheck /b/ml-opt-rel-x86-64-b1/llvm-project/llvm/test/CodeGen/RISCV/early-clobber-tied-def-subreg-liveness.ll
+ /b/ml-opt-rel-x86-64-b1/build/bin/llc -O2 -mtriple riscv64 -mattr=+v,+m,+zbb -enable-subreg-liveness -verify-machineinstrs
immarg operand has non-immediate parameter
  %4 = tail call <vscale x 8 x i16> @llvm.riscv.vle.nxv8i16.i64(<vscale x 8 x i16> undef, ptr nonnull @__const._Z3foov.var_44, i64 2)
  tail call void @llvm.riscv.vsseg4.nxv8i16.i64(<vscale x 8 x i16> %10, <vscale x 8 x i16> %2, <vscale x 8 x i16> %3, <vscale x 8 x i16> %4, ptr nonnull @var_47, i64 2)
Attribute 'nocapture' applied to incompatible type!
ptr @llvm.riscv.vsseg4.nxv8i16.i64
llc: error: '<stdin>': input module cannot be verified
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /b/ml-opt-rel-x86-64-b1/build/bin/FileCheck /b/ml-opt-rel-x86-64-b1/llvm-project/llvm/test/CodeGen/RISCV/early-clobber-tied-def-subreg-liveness.ll

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 31, 2024

LLVM Buildbot has detected a new failure on builder ml-opt-dev-x86-64 running on ml-opt-dev-x86-64-b2 while building clang,llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/137/builds/4418

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: CodeGen/RISCV/early-clobber-tied-def-subreg-liveness.ll' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 2: /b/ml-opt-dev-x86-64-b1/build/bin/llc -O2 -mtriple riscv64 -mattr=+v,+m,+zbb -enable-subreg-liveness      -verify-machineinstrs < /b/ml-opt-dev-x86-64-b1/llvm-project/llvm/test/CodeGen/RISCV/early-clobber-tied-def-subreg-liveness.ll      | /b/ml-opt-dev-x86-64-b1/build/bin/FileCheck /b/ml-opt-dev-x86-64-b1/llvm-project/llvm/test/CodeGen/RISCV/early-clobber-tied-def-subreg-liveness.ll
+ /b/ml-opt-dev-x86-64-b1/build/bin/llc -O2 -mtriple riscv64 -mattr=+v,+m,+zbb -enable-subreg-liveness -verify-machineinstrs
+ /b/ml-opt-dev-x86-64-b1/build/bin/FileCheck /b/ml-opt-dev-x86-64-b1/llvm-project/llvm/test/CodeGen/RISCV/early-clobber-tied-def-subreg-liveness.ll
immarg operand has non-immediate parameter
  %4 = tail call <vscale x 8 x i16> @llvm.riscv.vle.nxv8i16.i64(<vscale x 8 x i16> undef, ptr nonnull @__const._Z3foov.var_44, i64 2)
  tail call void @llvm.riscv.vsseg4.nxv8i16.i64(<vscale x 8 x i16> %10, <vscale x 8 x i16> %2, <vscale x 8 x i16> %3, <vscale x 8 x i16> %4, ptr nonnull @var_47, i64 2)
Attribute 'nocapture' applied to incompatible type!
ptr @llvm.riscv.vsseg4.nxv8i16.i64
llc: error: '<stdin>': input module cannot be verified
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /b/ml-opt-dev-x86-64-b1/build/bin/FileCheck /b/ml-opt-dev-x86-64-b1/llvm-project/llvm/test/CodeGen/RISCV/early-clobber-tied-def-subreg-liveness.ll

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 31, 2024

LLVM Buildbot has detected a new failure on builder ml-opt-devrel-x86-64 running on ml-opt-devrel-x86-64-b1 while building clang,llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/175/builds/4374

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: CodeGen/RISCV/early-clobber-tied-def-subreg-liveness.ll' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 2: /b/ml-opt-devrel-x86-64-b1/build/bin/llc -O2 -mtriple riscv64 -mattr=+v,+m,+zbb -enable-subreg-liveness      -verify-machineinstrs < /b/ml-opt-devrel-x86-64-b1/llvm-project/llvm/test/CodeGen/RISCV/early-clobber-tied-def-subreg-liveness.ll      | /b/ml-opt-devrel-x86-64-b1/build/bin/FileCheck /b/ml-opt-devrel-x86-64-b1/llvm-project/llvm/test/CodeGen/RISCV/early-clobber-tied-def-subreg-liveness.ll
+ /b/ml-opt-devrel-x86-64-b1/build/bin/FileCheck /b/ml-opt-devrel-x86-64-b1/llvm-project/llvm/test/CodeGen/RISCV/early-clobber-tied-def-subreg-liveness.ll
+ /b/ml-opt-devrel-x86-64-b1/build/bin/llc -O2 -mtriple riscv64 -mattr=+v,+m,+zbb -enable-subreg-liveness -verify-machineinstrs
immarg operand has non-immediate parameter
  %4 = tail call <vscale x 8 x i16> @llvm.riscv.vle.nxv8i16.i64(<vscale x 8 x i16> undef, ptr nonnull @__const._Z3foov.var_44, i64 2)
  tail call void @llvm.riscv.vsseg4.nxv8i16.i64(<vscale x 8 x i16> %10, <vscale x 8 x i16> %2, <vscale x 8 x i16> %3, <vscale x 8 x i16> %4, ptr nonnull @var_47, i64 2)
Attribute 'nocapture' applied to incompatible type!
ptr @llvm.riscv.vsseg4.nxv8i16.i64
llc: error: '<stdin>': input module cannot be verified
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /b/ml-opt-devrel-x86-64-b1/build/bin/FileCheck /b/ml-opt-devrel-x86-64-b1/llvm-project/llvm/test/CodeGen/RISCV/early-clobber-tied-def-subreg-liveness.ll

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 31, 2024

LLVM Buildbot has detected a new failure on builder premerge-monolithic-linux running on premerge-linux-1 while building clang,llvm at step 7 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/153/builds/7552

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: CodeGen/RISCV/rvv/vloxseg-rv64.ll' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 2: /build/buildbot/premerge-monolithic-linux/build/bin/llc -mtriple=riscv64 -mattr=+zve64d,+f,+d,+zfh,+zvfh      -verify-machineinstrs < /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/test/CodeGen/RISCV/rvv/vloxseg-rv64.ll | /build/buildbot/premerge-monolithic-linux/build/bin/FileCheck /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/test/CodeGen/RISCV/rvv/vloxseg-rv64.ll
+ /build/buildbot/premerge-monolithic-linux/build/bin/llc -mtriple=riscv64 -mattr=+zve64d,+f,+d,+zfh,+zvfh -verify-machineinstrs
+ /build/buildbot/premerge-monolithic-linux/build/bin/FileCheck /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/test/CodeGen/RISCV/rvv/vloxseg-rv64.ll
Attribute 'nocapture' applied to incompatible type!
ptr @llvm.riscv.vloxseg2.nxv16i16.nxv16i16
Attribute 'nocapture' applied to incompatible type!
ptr @llvm.riscv.vloxseg2.mask.nxv16i16.nxv16i16
immarg operand has non-immediate parameter
i64 %vl
  %0 = tail call { <vscale x 16 x i16>, <vscale x 16 x i16> } @llvm.riscv.vloxseg2.nxv16i16.nxv16i16(<vscale x 16 x i16> undef, <vscale x 16 x i16> undef, ptr %base, <vscale x 16 x i16> %index, i64 %vl)
immarg operand has non-immediate parameter
i64 %vl
  %0 = tail call { <vscale x 16 x i16>, <vscale x 16 x i16> } @llvm.riscv.vloxseg2.mask.nxv16i16.nxv16i16(<vscale x 16 x i16> %val, <vscale x 16 x i16> %val, ptr %base, <vscale x 16 x i16> %index, <vscale x 16 x i1> %mask, i64 %vl, i64 1)
Attribute 'nocapture' applied to incompatible type!
ptr @llvm.riscv.vloxseg2.nxv16i16.nxv16i8
Attribute 'nocapture' applied to incompatible type!
ptr @llvm.riscv.vloxseg2.mask.nxv16i16.nxv16i8
immarg operand has non-immediate parameter
i64 %vl
  %0 = tail call { <vscale x 16 x i16>, <vscale x 16 x i16> } @llvm.riscv.vloxseg2.nxv16i16.nxv16i8(<vscale x 16 x i16> undef, <vscale x 16 x i16> undef, ptr %base, <vscale x 16 x i8> %index, i64 %vl)
immarg operand has non-immediate parameter
i64 %vl
  %0 = tail call { <vscale x 16 x i16>, <vscale x 16 x i16> } @llvm.riscv.vloxseg2.mask.nxv16i16.nxv16i8(<vscale x 16 x i16> %val, <vscale x 16 x i16> %val, ptr %base, <vscale x 16 x i8> %index, <vscale x 16 x i1> %mask, i64 %vl, i64 1)
Attribute 'nocapture' applied to incompatible type!
ptr @llvm.riscv.vloxseg2.nxv16i16.nxv16i32
Attribute 'nocapture' applied to incompatible type!
ptr @llvm.riscv.vloxseg2.mask.nxv16i16.nxv16i32
immarg operand has non-immediate parameter
i64 %vl
  %0 = tail call { <vscale x 16 x i16>, <vscale x 16 x i16> } @llvm.riscv.vloxseg2.nxv16i16.nxv16i32(<vscale x 16 x i16> undef, <vscale x 16 x i16> undef, ptr %base, <vscale x 16 x i32> %index, i64 %vl)
immarg operand has non-immediate parameter
i64 %vl
  %0 = tail call { <vscale x 16 x i16>, <vscale x 16 x i16> } @llvm.riscv.vloxseg2.mask.nxv16i16.nxv16i32(<vscale x 16 x i16> %val, <vscale x 16 x i16> %val, ptr %base, <vscale x 16 x i32> %index, <vscale x 16 x i1> %mask, i64 %vl, i64 1)
Attribute 'nocapture' applied to incompatible type!
ptr @llvm.riscv.vloxseg2.nxv4i32.nxv4i32
Attribute 'nocapture' applied to incompatible type!
ptr @llvm.riscv.vloxseg2.mask.nxv4i32.nxv4i32
immarg operand has non-immediate parameter
i64 %vl
  %0 = tail call { <vscale x 4 x i32>, <vscale x 4 x i32> } @llvm.riscv.vloxseg2.nxv4i32.nxv4i32(<vscale x 4 x i32> undef, <vscale x 4 x i32> undef, ptr %base, <vscale x 4 x i32> %index, i64 %vl)
immarg operand has non-immediate parameter
i64 %vl
  %0 = tail call { <vscale x 4 x i32>, <vscale x 4 x i32> } @llvm.riscv.vloxseg2.mask.nxv4i32.nxv4i32(<vscale x 4 x i32> %val, <vscale x 4 x i32> %val, ptr %base, <vscale x 4 x i32> %index, <vscale x 4 x i1> %mask, i64 %vl, i64 1)
Attribute 'nocapture' applied to incompatible type!
ptr @llvm.riscv.vloxseg2.nxv4i32.nxv4i8
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 31, 2024

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-expensive-checks-debian running on gribozavr4 while building clang,llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/16/builds/4505

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: CodeGen/RISCV/early-clobber-tied-def-subreg-liveness.ll' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 2: /b/1/llvm-clang-x86_64-expensive-checks-debian/build/bin/llc -O2 -mtriple riscv64 -mattr=+v,+m,+zbb -enable-subreg-liveness      -verify-machineinstrs < /b/1/llvm-clang-x86_64-expensive-checks-debian/llvm-project/llvm/test/CodeGen/RISCV/early-clobber-tied-def-subreg-liveness.ll      | /b/1/llvm-clang-x86_64-expensive-checks-debian/build/bin/FileCheck /b/1/llvm-clang-x86_64-expensive-checks-debian/llvm-project/llvm/test/CodeGen/RISCV/early-clobber-tied-def-subreg-liveness.ll
+ /b/1/llvm-clang-x86_64-expensive-checks-debian/build/bin/llc -O2 -mtriple riscv64 -mattr=+v,+m,+zbb -enable-subreg-liveness -verify-machineinstrs
+ /b/1/llvm-clang-x86_64-expensive-checks-debian/build/bin/FileCheck /b/1/llvm-clang-x86_64-expensive-checks-debian/llvm-project/llvm/test/CodeGen/RISCV/early-clobber-tied-def-subreg-liveness.ll
immarg operand has non-immediate parameter
  %4 = tail call <vscale x 8 x i16> @llvm.riscv.vle.nxv8i16.i64(<vscale x 8 x i16> undef, ptr nonnull @__const._Z3foov.var_44, i64 2)
  tail call void @llvm.riscv.vsseg4.nxv8i16.i64(<vscale x 8 x i16> %10, <vscale x 8 x i16> %2, <vscale x 8 x i16> %3, <vscale x 8 x i16> %4, ptr nonnull @var_47, i64 2)
Attribute 'nocapture' applied to incompatible type!
ptr @llvm.riscv.vsseg4.nxv8i16.i64
llc: error: '<stdin>': input module cannot be verified
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /b/1/llvm-clang-x86_64-expensive-checks-debian/build/bin/FileCheck /b/1/llvm-clang-x86_64-expensive-checks-debian/llvm-project/llvm/test/CodeGen/RISCV/early-clobber-tied-def-subreg-liveness.ll

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 31, 2024

LLVM Buildbot has detected a new failure on builder clang-x86_64-debian-fast running on gribozavr4 while building clang,llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/56/builds/6213

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: CodeGen/RISCV/regalloc-last-chance-recoloring-failure.ll' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 2: /b/1/clang-x86_64-debian-fast/llvm.obj/bin/llc -mtriple=riscv64 -mattr=+f,+m,+zfh,+zvfh    -enable-subreg-liveness=false < /b/1/clang-x86_64-debian-fast/llvm.src/llvm/test/CodeGen/RISCV/regalloc-last-chance-recoloring-failure.ll | /b/1/clang-x86_64-debian-fast/llvm.obj/bin/FileCheck /b/1/clang-x86_64-debian-fast/llvm.src/llvm/test/CodeGen/RISCV/regalloc-last-chance-recoloring-failure.ll
+ /b/1/clang-x86_64-debian-fast/llvm.obj/bin/FileCheck /b/1/clang-x86_64-debian-fast/llvm.src/llvm/test/CodeGen/RISCV/regalloc-last-chance-recoloring-failure.ll
+ /b/1/clang-x86_64-debian-fast/llvm.obj/bin/llc -mtriple=riscv64 -mattr=+f,+m,+zfh,+zvfh -enable-subreg-liveness=false
Intrinsic has incorrect argument type!
ptr @llvm.riscv.vloxseg2.nxv16f16.nxv16i32.i64
Attribute 'nocapture' applied to incompatible type!
ptr @llvm.riscv.vloxseg2.nxv16f16.nxv16i32.i64
llc: error: '<stdin>': input module cannot be verified
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /b/1/clang-x86_64-debian-fast/llvm.obj/bin/FileCheck /b/1/clang-x86_64-debian-fast/llvm.src/llvm/test/CodeGen/RISCV/regalloc-last-chance-recoloring-failure.ll

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 31, 2024

LLVM Buildbot has detected a new failure on builder llvm-x86_64-debian-dylib running on gribozavr4 while building clang,llvm at step 7 "test-build-unified-tree-check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/60/builds/6383

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-llvm) failure: test (failure)
******************** TEST 'LLVM :: CodeGen/RISCV/early-clobber-tied-def-subreg-liveness.ll' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 2: /b/1/llvm-x86_64-debian-dylib/build/bin/llc -O2 -mtriple riscv64 -mattr=+v,+m,+zbb -enable-subreg-liveness      -verify-machineinstrs < /b/1/llvm-x86_64-debian-dylib/llvm-project/llvm/test/CodeGen/RISCV/early-clobber-tied-def-subreg-liveness.ll      | /b/1/llvm-x86_64-debian-dylib/build/bin/FileCheck /b/1/llvm-x86_64-debian-dylib/llvm-project/llvm/test/CodeGen/RISCV/early-clobber-tied-def-subreg-liveness.ll
+ /b/1/llvm-x86_64-debian-dylib/build/bin/llc -O2 -mtriple riscv64 -mattr=+v,+m,+zbb -enable-subreg-liveness -verify-machineinstrs
+ /b/1/llvm-x86_64-debian-dylib/build/bin/FileCheck /b/1/llvm-x86_64-debian-dylib/llvm-project/llvm/test/CodeGen/RISCV/early-clobber-tied-def-subreg-liveness.ll
immarg operand has non-immediate parameter
  %4 = tail call <vscale x 8 x i16> @llvm.riscv.vle.nxv8i16.i64(<vscale x 8 x i16> undef, ptr nonnull @__const._Z3foov.var_44, i64 2)
  tail call void @llvm.riscv.vsseg4.nxv8i16.i64(<vscale x 8 x i16> %10, <vscale x 8 x i16> %2, <vscale x 8 x i16> %3, <vscale x 8 x i16> %4, ptr nonnull @var_47, i64 2)
Attribute 'nocapture' applied to incompatible type!
ptr @llvm.riscv.vsseg4.nxv8i16.i64
llc: error: '<stdin>': input module cannot be verified
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /b/1/llvm-x86_64-debian-dylib/build/bin/FileCheck /b/1/llvm-x86_64-debian-dylib/llvm-project/llvm/test/CodeGen/RISCV/early-clobber-tied-def-subreg-liveness.ll

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 31, 2024

LLVM Buildbot has detected a new failure on builder lld-x86_64-ubuntu-fast running on as-builder-4 while building clang,llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/33/builds/2187

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: CodeGen/RISCV/early-clobber-tied-def-subreg-liveness.ll' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 2: /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/bin/llc -O2 -mtriple riscv64 -mattr=+v,+m,+zbb -enable-subreg-liveness      -verify-machineinstrs < /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/llvm/test/CodeGen/RISCV/early-clobber-tied-def-subreg-liveness.ll      | /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/bin/FileCheck /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/llvm/test/CodeGen/RISCV/early-clobber-tied-def-subreg-liveness.ll
+ /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/bin/FileCheck /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/llvm/test/CodeGen/RISCV/early-clobber-tied-def-subreg-liveness.ll
+ /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/bin/llc -O2 -mtriple riscv64 -mattr=+v,+m,+zbb -enable-subreg-liveness -verify-machineinstrs
immarg operand has non-immediate parameter
  %4 = tail call <vscale x 8 x i16> @llvm.riscv.vle.nxv8i16.i64(<vscale x 8 x i16> undef, ptr nonnull @__const._Z3foov.var_44, i64 2)
  tail call void @llvm.riscv.vsseg4.nxv8i16.i64(<vscale x 8 x i16> %10, <vscale x 8 x i16> %2, <vscale x 8 x i16> %3, <vscale x 8 x i16> %4, ptr nonnull @var_47, i64 2)
Attribute 'nocapture' applied to incompatible type!
ptr @llvm.riscv.vsseg4.nxv8i16.i64
llc: error: '<stdin>': input module cannot be verified
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/bin/FileCheck /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/llvm/test/CodeGen/RISCV/early-clobber-tied-def-subreg-liveness.ll

--

********************


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:RISC-V clang:codegen IR generation bugs: mangling, exceptions, etc. clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category llvm:analysis llvm:ir llvm:transforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants