Home | History | Annotate | Download | only in Bitcode
      1 ; Basic sanity test to check that instruction operands are encoded with
      2 ; relative IDs.
      3 ; RUN: llvm-as < %s | llvm-bcanalyzer -dump | FileCheck %s
      4 ; RUN: verify-uselistorder < %s
      5 
      6 ; CHECK: FUNCTION_BLOCK
      7 ; CHECK: INST_BINOP {{.*}}op0=1 op1=1
      8 ; CHECK: INST_BINOP {{.*}}op0=1 op1=1
      9 ; CHECK: INST_BINOP {{.*}}op0=1 op1=1
     10 ; CHECK: INST_RET {{.*}}op0=1
     11 define i32 @test_int_binops(i32 %a) nounwind {
     12 entry:
     13   %0 = add i32 %a, %a
     14   %1 = sub i32 %0, %0
     15   %2 = mul i32 %1, %1
     16   ret i32 %2
     17 }
     18 
     19 
     20 ; CHECK: FUNCTION_BLOCK
     21 ; CHECK: INST_CAST {{.*}}op0=1
     22 ; CHECK: INST_BINOP {{.*}}op0=1 op1=1
     23 ; CHECK: INST_BINOP {{.*}}op0=1 op1=1
     24 ; CHECK: INST_BINOP {{.*}}op0=1 op1=1
     25 ; CHECK: INST_BINOP {{.*}}op0=1 op1=1
     26 ; CHECK: INST_RET {{.*}}op0=1
     27 define double @test_float_binops(i32 %a) nounwind {
     28   %1 = sitofp i32 %a to double
     29   %2 = fadd double %1, %1
     30   %3 = fsub double %2, %2
     31   %4 = fmul double %3, %3
     32   %5 = fdiv double %4, %4
     33   ret double %5
     34 }
     35 
     36 
     37 ; CHECK: FUNCTION_BLOCK
     38 ; skip checking operands of INST_GEP since that depends on ordering
     39 ; between literals and the formal parameters.
     40 ; CHECK: INST_GEP {{.*}}
     41 ; CHECK: INST_LOAD {{.*}}op0=1 {{.*}}
     42 ; CHECK: INST_CMP2 op0=1 {{.*}}
     43 ; CHECK: INST_RET {{.*}}op0=1
     44 define i1 @test_load(i32 %a, {i32, i32}* %ptr) nounwind {
     45 entry:
     46   %0 = getelementptr inbounds {i32, i32}, {i32, i32}* %ptr, i32 %a, i32 0
     47   %1 = load i32, i32* %0
     48   %2 = icmp eq i32 %1, %a
     49   ret i1 %2
     50 }
     51 
     52 ; CHECK: Stream type: LLVM IR
     53