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 
      5 ; CHECK: FUNCTION_BLOCK
      6 ; CHECK: INST_BINOP {{.*}}op0=1 op1=1
      7 ; CHECK: INST_BINOP {{.*}}op0=1 op1=1
      8 ; CHECK: INST_BINOP {{.*}}op0=1 op1=1
      9 ; CHECK: INST_RET {{.*}}op0=1
     10 define i32 @test_int_binops(i32 %a) nounwind {
     11 entry:
     12   %0 = add i32 %a, %a
     13   %1 = sub i32 %0, %0
     14   %2 = mul i32 %1, %1
     15   ret i32 %2
     16 }
     17 
     18 
     19 ; CHECK: FUNCTION_BLOCK
     20 ; CHECK: INST_CAST {{.*}}op0=1
     21 ; CHECK: INST_BINOP {{.*}}op0=1 op1=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_RET {{.*}}op0=1
     26 define double @test_float_binops(i32 %a) nounwind {
     27   %1 = sitofp i32 %a to double
     28   %2 = fadd double %1, %1
     29   %3 = fsub double %2, %2
     30   %4 = fmul double %3, %3
     31   %5 = fdiv double %4, %4
     32   ret double %5
     33 }
     34 
     35 
     36 ; CHECK: FUNCTION_BLOCK
     37 ; skip checking operands of INST_INBOUNDS_GEP since that depends on ordering
     38 ; between literals and the formal parameters.
     39 ; CHECK: INST_INBOUNDS_GEP {{.*}}
     40 ; CHECK: INST_LOAD {{.*}}op0=1 {{.*}}
     41 ; CHECK: INST_CMP2 op0=1 {{.*}}
     42 ; CHECK: INST_RET {{.*}}op0=1
     43 define i1 @test_load(i32 %a, {i32, i32}* %ptr) nounwind {
     44 entry:
     45   %0 = getelementptr inbounds {i32, i32}* %ptr, i32 %a, i32 0
     46   %1 = load i32* %0
     47   %2 = icmp eq i32 %1, %a
     48   ret i1 %2
     49 }
     50