fallback: legalize: G_SUB <N x i128>

Run:explore-db12fc36f6-20261127-115111
Kind:fallback
Category:legalize: G_SUB <N x i128> M
Occurrences:3 in 3 configs, 3 test files, 3 more counted only
Snippet from:fpclamptosat_vec.aff538788a.ll (mutant of fpclamptosat_vec.ll) @ustest_f32i64_mm via llvm-extract
Config:-mtriple=riscv64 -verify-machineinstrs -target-abi=lp64d -riscv-v-vector-bits-min=0 -mattr=+f,+v -O1
Local check:reproduces at db12fc36f6
Compiler Explorer:not uploaded (over --godbolt-limit or disabled)

Snippet:

@G = external global <2 x i128>

define <2 x i64> @ustest_f32i64_mm(<2 x float> %x) {
entry:
  %conv = fptosi <2 x float> %x to <2 x i128>
  %spec.store.select = call <2 x i128> @llvm.smin.v2i128(<2 x i128> %conv, <2 x i128> splat (i128 18446744073709551616))
  %spec.store.select7 = call <2 x i128> @llvm.smax.v2i128(<2 x i128> %spec.store.select, <2 x i128> zeroinitializer)
  %B = sub <2 x i128> %spec.store.select, zeroinitializer
  %conv6 = trunc <2 x i128> %spec.store.select7 to <2 x i64>
  store <2 x i128> %B, ptr @G, align 32
  ret <2 x i64> %conv6
}

; Function Attrs: nocallback nocreateundeforpoison nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i128> @llvm.smax.v2i128(<2 x i128>, <2 x i128>) #0

; Function Attrs: nocallback nocreateundeforpoison nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i128> @llvm.smin.v2i128(<2 x i128>, <2 x i128>) #0

attributes #0 = { nocallback nocreateundeforpoison nofree nosync nounwind speculatable willreturn memory(none) }

Reproduce:

llc -mtriple=riscv64 -verify-machineinstrs -target-abi=lp64d -riscv-v-vector-bits-min=0 -mattr=+f,+v -O1 -global-isel -global-isel-abort=2 -pass-remarks-missed=gisel.* snippet.ll -o -
llc -mtriple=riscv64 -verify-machineinstrs -target-abi=lp64d -riscv-v-vector-bits-min=0 -mattr=+f,+v -O1 -global-isel=0 snippet.ll -o -

Local llc output:

remark: <unknown>:0:0: unable to legalize instruction: %10:_(<2 x i128>) = G_SUB %6:_, %7:_ (in function: ustest_f32i64_mm)
warning: Instruction selection used fallback path for ustest_f32i64_mm

Occurrences (3):

InputFunctionConfig
clmulh.e31a061c9f.ll (mutant of clmulh.ll)commutative_clmulh_v2i64-mtriple=riscv32 -verify-machineinstrs -mattr=+m,+zbs,+xtheadba -O1
clmulr.68888788da.ll (mutant of clmulr.ll)commutative_clmulr_v2i64-mtriple=riscv64 -verify-machineinstrs -mattr=+m,+zbs -O3
fpclamptosat_vec.aff538788a.ll (mutant of fpclamptosat_vec.ll)ustest_f32i64_mm-mtriple=riscv64 -verify-machineinstrs -target-abi=lp64d -riscv-v-vector-bits-min=0 -mattr=+f,+v -O1

Generated 2026-11-29 14:49 UTC.