function-encoding-rel-operands.ll 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. ; 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. ; CHECK: FUNCTION_BLOCK
  18. ; CHECK: INST_CAST {{.*}}op0=1
  19. ; CHECK: INST_BINOP {{.*}}op0=1 op1=1
  20. ; CHECK: INST_BINOP {{.*}}op0=1 op1=1
  21. ; CHECK: INST_BINOP {{.*}}op0=1 op1=1
  22. ; CHECK: INST_BINOP {{.*}}op0=1 op1=1
  23. ; CHECK: INST_RET {{.*}}op0=1
  24. define double @test_float_binops(i32 %a) nounwind {
  25. %1 = sitofp i32 %a to double
  26. %2 = fadd double %1, %1
  27. %3 = fsub double %2, %2
  28. %4 = fmul double %3, %3
  29. %5 = fdiv double %4, %4
  30. ret double %5
  31. }
  32. ; CHECK: FUNCTION_BLOCK
  33. ; skip checking operands of INST_GEP since that depends on ordering
  34. ; between literals and the formal parameters.
  35. ; CHECK: INST_GEP {{.*}}
  36. ; CHECK: INST_LOAD {{.*}}op0=1 {{.*}}
  37. ; CHECK: INST_CMP2 op0=1 {{.*}}
  38. ; CHECK: INST_RET {{.*}}op0=1
  39. define i1 @test_load(i32 %a, {i32, i32}* %ptr) nounwind {
  40. entry:
  41. %0 = getelementptr inbounds {i32, i32}, {i32, i32}* %ptr, i32 %a, i32 0
  42. %1 = load i32, i32* %0
  43. %2 = icmp eq i32 %1, %a
  44. ret i1 %2
  45. }
  46. ; CHECK: Stream type: LLVM IR