Index: test/Bindings/llvm-c/echo.ll =================================================================== --- test/Bindings/llvm-c/echo.ll +++ test/Bindings/llvm-c/echo.ll @@ -21,12 +21,24 @@ ret void } -define i32 @add(i32 %a, i32 %b) { +define i32 @iops(i32 %a, i32 %b) { %1 = add i32 %a, %b - ret i32 %1 + %2 = mul i32 %a, %1 + %3 = sub i32 %2, %1 + %4 = udiv i32 %3, %b + %5 = sdiv i32 %2, %4 + %6 = urem i32 %3, %5 + %7 = srem i32 %2, %6 + %8 = shl i32 %1, %b + %9 = lshr i32 %a, %7 + %10 = ashr i32 %b, %8 + %11 = and i32 %9, %10 + %12 = or i32 %2, %11 + %13 = xor i32 %12, %4 + ret i32 %13 } define i32 @call() { - %1 = call i32 @add(i32 23, i32 19) + %1 = call i32 @iops(i32 23, i32 19) ret i32 %1 } Index: tools/llvm-c-test/echo.cpp =================================================================== --- tools/llvm-c-test/echo.cpp +++ tools/llvm-c-test/echo.cpp @@ -215,6 +215,78 @@ Dst = LLVMBuildAdd(Builder, LHS, RHS, Name); break; } + case LLVMSub: { + LLVMValueRef LHS = clone_value(LLVMGetOperand(Src, 0), Builder, VMap); + LLVMValueRef RHS = clone_value(LLVMGetOperand(Src, 1), Builder, VMap); + Dst = LLVMBuildSub(Builder, LHS, RHS, Name); + break; + } + case LLVMMul: { + LLVMValueRef LHS = clone_value(LLVMGetOperand(Src, 0), Builder, VMap); + LLVMValueRef RHS = clone_value(LLVMGetOperand(Src, 1), Builder, VMap); + Dst = LLVMBuildMul(Builder, LHS, RHS, Name); + break; + } + case LLVMUDiv: { + LLVMValueRef LHS = clone_value(LLVMGetOperand(Src, 0), Builder, VMap); + LLVMValueRef RHS = clone_value(LLVMGetOperand(Src, 1), Builder, VMap); + Dst = LLVMBuildUDiv(Builder, LHS, RHS, Name); + break; + } + case LLVMSDiv: { + LLVMValueRef LHS = clone_value(LLVMGetOperand(Src, 0), Builder, VMap); + LLVMValueRef RHS = clone_value(LLVMGetOperand(Src, 1), Builder, VMap); + Dst = LLVMBuildSDiv(Builder, LHS, RHS, Name); + break; + } + case LLVMURem: { + LLVMValueRef LHS = clone_value(LLVMGetOperand(Src, 0), Builder, VMap); + LLVMValueRef RHS = clone_value(LLVMGetOperand(Src, 1), Builder, VMap); + Dst = LLVMBuildURem(Builder, LHS, RHS, Name); + break; + } + case LLVMSRem: { + LLVMValueRef LHS = clone_value(LLVMGetOperand(Src, 0), Builder, VMap); + LLVMValueRef RHS = clone_value(LLVMGetOperand(Src, 1), Builder, VMap); + Dst = LLVMBuildSRem(Builder, LHS, RHS, Name); + break; + } + case LLVMShl: { + LLVMValueRef LHS = clone_value(LLVMGetOperand(Src, 0), Builder, VMap); + LLVMValueRef RHS = clone_value(LLVMGetOperand(Src, 1), Builder, VMap); + Dst = LLVMBuildShl(Builder, LHS, RHS, Name); + break; + } + case LLVMLShr: { + LLVMValueRef LHS = clone_value(LLVMGetOperand(Src, 0), Builder, VMap); + LLVMValueRef RHS = clone_value(LLVMGetOperand(Src, 1), Builder, VMap); + Dst = LLVMBuildLShr(Builder, LHS, RHS, Name); + break; + } + case LLVMAShr: { + LLVMValueRef LHS = clone_value(LLVMGetOperand(Src, 0), Builder, VMap); + LLVMValueRef RHS = clone_value(LLVMGetOperand(Src, 1), Builder, VMap); + Dst = LLVMBuildAShr(Builder, LHS, RHS, Name); + break; + } + case LLVMAnd: { + LLVMValueRef LHS = clone_value(LLVMGetOperand(Src, 0), Builder, VMap); + LLVMValueRef RHS = clone_value(LLVMGetOperand(Src, 1), Builder, VMap); + Dst = LLVMBuildAnd(Builder, LHS, RHS, Name); + break; + } + case LLVMOr: { + LLVMValueRef LHS = clone_value(LLVMGetOperand(Src, 0), Builder, VMap); + LLVMValueRef RHS = clone_value(LLVMGetOperand(Src, 1), Builder, VMap); + Dst = LLVMBuildOr(Builder, LHS, RHS, Name); + break; + } + case LLVMXor: { + LLVMValueRef LHS = clone_value(LLVMGetOperand(Src, 0), Builder, VMap); + LLVMValueRef RHS = clone_value(LLVMGetOperand(Src, 1), Builder, VMap); + Dst = LLVMBuildXor(Builder, LHS, RHS, Name); + break; + } case LLVMAlloca: { LLVMTypeRef Ty = LLVMGetElementType(LLVMTypeOf(Src)); Dst = LLVMBuildAlloca(Builder, Ty, Name);