1; This is a very early test that just checks the representation of i32 2; arithmetic instructions. No assembly tests are done. 3 4; REQUIRES: allow_dump 5 6; RUN: %p2i -i %s --filetype=asm --args --verbose inst -threads=0 \ 7; RUN: -allow-externally-defined-symbols | FileCheck %s 8 9define internal i32 @Add(i32 %a, i32 %b) { 10; CHECK: define internal i32 @Add 11entry: 12 %add = add i32 %b, %a 13; CHECK: add 14 tail call void @Use(i32 %add) 15; CHECK: call Use 16 ret i32 %add 17} 18 19declare void @Use(i32) 20 21define internal i32 @And(i32 %a, i32 %b) { 22; CHECK: define internal i32 @And 23entry: 24 %and = and i32 %b, %a 25; CHECK: and 26 tail call void @Use(i32 %and) 27; CHECK: call Use 28 ret i32 %and 29} 30 31define internal i32 @Or(i32 %a, i32 %b) { 32; CHECK: define internal i32 @Or 33entry: 34 %or = or i32 %b, %a 35; CHECK: or 36 tail call void @Use(i32 %or) 37; CHECK: call Use 38 ret i32 %or 39} 40 41define internal i32 @Xor(i32 %a, i32 %b) { 42; CHECK: define internal i32 @Xor 43entry: 44 %xor = xor i32 %b, %a 45; CHECK: xor 46 tail call void @Use(i32 %xor) 47; CHECK: call Use 48 ret i32 %xor 49} 50 51define internal i32 @Sub(i32 %a, i32 %b) { 52; CHECK: define internal i32 @Sub 53entry: 54 %sub = sub i32 %a, %b 55; CHECK: sub 56 tail call void @Use(i32 %sub) 57; CHECK: call Use 58 ret i32 %sub 59} 60 61define internal i32 @Mul(i32 %a, i32 %b) { 62; CHECK: define internal i32 @Mul 63entry: 64 %mul = mul i32 %b, %a 65; CHECK: imul 66 tail call void @Use(i32 %mul) 67; CHECK: call Use 68 ret i32 %mul 69} 70 71define internal i32 @Sdiv(i32 %a, i32 %b) { 72; CHECK: define internal i32 @Sdiv 73entry: 74 %div = sdiv i32 %a, %b 75; CHECK: cdq 76; CHECK: idiv 77 tail call void @Use(i32 %div) 78; CHECK: call Use 79 ret i32 %div 80} 81 82define internal i32 @Srem(i32 %a, i32 %b) { 83; CHECK: define internal i32 @Srem 84entry: 85 %rem = srem i32 %a, %b 86; CHECK: cdq 87; CHECK: idiv 88 tail call void @Use(i32 %rem) 89; CHECK: call Use 90 ret i32 %rem 91} 92 93define internal i32 @Udiv(i32 %a, i32 %b) { 94; CHECK: define internal i32 @Udiv 95entry: 96 %div = udiv i32 %a, %b 97; CHECK: div 98 tail call void @Use(i32 %div) 99; CHECK: call Use 100 ret i32 %div 101} 102 103define internal i32 @Urem(i32 %a, i32 %b) { 104; CHECK: define internal i32 @Urem 105entry: 106 %rem = urem i32 %a, %b 107; CHECK: div 108 tail call void @Use(i32 %rem) 109; CHECK: call Use 110 ret i32 %rem 111} 112 113; Check for a valid addressing mode in the x86-32 mul instruction when 114; the second source operand is an immediate. 115define internal i64 @MulImm() { 116entry: 117 %mul = mul i64 3, 4 118 ret i64 %mul 119} 120; CHECK-LABEL: MulImm 121; CHECK-NOT: mul {{[0-9]+}} 122