From e5b6df2e32e04d644500eaf14bbe1bc8f7a70aa1 Mon Sep 17 00:00:00 2001 From: Wang Pengcheng Date: Fri, 24 Jan 2025 17:29:55 +0800 Subject: [PATCH] [RISCV] Enable RVV ABD tests with i64 elements The comment says it will crash but the crash has been fixed. --- llvm/test/CodeGen/RISCV/rvv/abd.ll | 48 +++++++++++++++++++----------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/llvm/test/CodeGen/RISCV/rvv/abd.ll b/llvm/test/CodeGen/RISCV/rvv/abd.ll index 5e610c453e1ba..583d872238df7 100644 --- a/llvm/test/CodeGen/RISCV/rvv/abd.ll +++ b/llvm/test/CodeGen/RISCV/rvv/abd.ll @@ -103,15 +103,21 @@ define @sabd_s_promoted_ops( %a, %abs } -; FIXME: Crashes legalization if enabled -;; define @sabd_d( %a, %b) { -;; %a.sext = sext %a to -;; %b.sext = sext %b to -;; %sub = sub %a.sext, %b.sext -;; %abs = call @llvm.abs.nxv2i128( %sub, i1 true) -;; %trunc = trunc %abs to -;; ret %trunc -;; } +define @sabd_d( %a, %b) { +; CHECK-LABEL: sabd_d: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64, m2, ta, ma +; CHECK-NEXT: vmin.vv v12, v8, v10 +; CHECK-NEXT: vmax.vv v8, v8, v10 +; CHECK-NEXT: vsub.vv v8, v8, v12 +; CHECK-NEXT: ret + %a.sext = sext %a to + %b.sext = sext %b to + %sub = sub %a.sext, %b.sext + %abs = call @llvm.abs.nxv2i128( %sub, i1 true) + %trunc = trunc %abs to + ret %trunc +} define @sabd_d_promoted_ops( %a, %b) { ; CHECK-LABEL: sabd_d_promoted_ops: @@ -231,15 +237,21 @@ define @uabd_s_promoted_ops( %a, %abs } -; FIXME: Crashes legalization if enabled -;; define @uabd_d( %a, %b) { -;; %a.zext = zext %a to -;; %b.zext = zext %b to -;; %sub = sub %a.zext, %b.zext -;; %abs = call @llvm.abs.nxv2i128( %sub, i1 true) -;; %trunc = trunc %abs to -;; ret %trunc -;; } +define @uabd_d( %a, %b) { +; CHECK-LABEL: uabd_d: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e64, m2, ta, ma +; CHECK-NEXT: vminu.vv v12, v8, v10 +; CHECK-NEXT: vmaxu.vv v8, v8, v10 +; CHECK-NEXT: vsub.vv v8, v8, v12 +; CHECK-NEXT: ret + %a.zext = zext %a to + %b.zext = zext %b to + %sub = sub %a.zext, %b.zext + %abs = call @llvm.abs.nxv2i128( %sub, i1 true) + %trunc = trunc %abs to + ret %trunc +} define @uabd_d_promoted_ops( %a, %b) { ; CHECK-LABEL: uabd_d_promoted_ops: