From 4b125b23ba9562ca013caf85ab23d1630417b3e2 Mon Sep 17 00:00:00 2001 From: David Stuttard Date: Mon, 5 Jul 2021 11:08:03 +0100 Subject: [PATCH] [DAGCombiner] Pre-commit test to demonstrate mulhi const folding D103323 will fold this Differential Revision: https://reviews.llvm.org/D105424 Change-Id: I64947215eb531fbd70b52a72203b39e43fefafcc --- llvm/test/CodeGen/AMDGPU/udiv.ll | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/llvm/test/CodeGen/AMDGPU/udiv.ll b/llvm/test/CodeGen/AMDGPU/udiv.ll index de5c282..1f68430 100644 --- a/llvm/test/CodeGen/AMDGPU/udiv.ll +++ b/llvm/test/CodeGen/AMDGPU/udiv.ll @@ -200,3 +200,18 @@ bb: store i8 %tmp6, i8 addrspace(1)* null, align 1 ret void } + +define i64 @v_test_udiv64_mulhi_fold(i64 %arg) { +; GCN-LABEL: v_test_udiv64_mulhi_fold +; GFX1030: s_mov_b32 [[VAL1:s[0-9]+]], 0xa9000000 +; GFX1030: s_brev_b32 [[VAL2:s[0-9]+]], 6 +; GFX1030: s_movk_i32 [[VAL3:s[0-9]+]], 0x500 +; GFX1030: s_mul_hi_u32 s7, [[VAL1]], [[VAL2]] +; GFX1030: s_mov_b32 [[VAL4:s[0-9]+]], 0xa7c5 +; GFX1030: s_mul_hi_u32 s8, [[VAL1]], [[VAL3]] +; GFX1030: s_mul_hi_u32 s5, [[VAL4]], [[VAL2]] +; GFX1030: s_mul_hi_u32 s6, [[VAL4]], [[VAL3]] +; GFX1030: v_add_co_u32 v{{[0-9]+}}, s{{[0-9]+}}, s{{[0-9]+}}, s{{[0-9]+}} + %d = udiv i64 %arg, 100000 + ret i64 %d +} -- 2.7.4