brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 14fe5b4 Raw
62 lines · plain
1; RUN: llc < %s -asm-verbose=false -wasm-keep-registers | FileCheck %s2 3; Test that integer div and rem by constant are optimized appropriately.4 5target triple = "wasm32-unknown-unknown"6 7; CHECK-LABEL: test_udiv_2:8; CHECK: i32.shr_u9define i32 @test_udiv_2(i32 %x) {10    %t = udiv i32 %x, 211    ret i32 %t12}13 14; CHECK-LABEL: test_udiv_5:15; CHECK: i32.div_u16define i32 @test_udiv_5(i32 %x) {17    %t = udiv i32 %x, 518    ret i32 %t19}20 21; CHECK-LABEL: test_sdiv_2:22; CHECK: i32.div_s23define i32 @test_sdiv_2(i32 %x) {24    %t = sdiv i32 %x, 225    ret i32 %t26}27 28; CHECK-LABEL: test_sdiv_5:29; CHECK: i32.div_s30define i32 @test_sdiv_5(i32 %x) {31    %t = sdiv i32 %x, 532    ret i32 %t33}34 35; CHECK-LABEL: test_urem_2:36; CHECK: i32.and37define i32 @test_urem_2(i32 %x) {38    %t = urem i32 %x, 239    ret i32 %t40}41 42; CHECK-LABEL: test_urem_5:43; CHECK: i32.rem_u44define i32 @test_urem_5(i32 %x) {45    %t = urem i32 %x, 546    ret i32 %t47}48 49; CHECK-LABEL: test_srem_2:50; CHECK: i32.rem_s51define i32 @test_srem_2(i32 %x) {52    %t = srem i32 %x, 253    ret i32 %t54}55 56; CHECK-LABEL: test_srem_5:57; CHECK: i32.rem_s58define i32 @test_srem_5(i32 %x) {59    %t = srem i32 %x, 560    ret i32 %t61}62