large-immediate.ll 1006 B

123456789101112131415161718192021222324252627282930313233343536
  1. ; RUN: opt -mtriple=x86_64-darwin-unknown -S -consthoist < %s | FileCheck %s
  2. define i128 @test1(i128 %a) nounwind {
  3. ; CHECK-LABEL: test1
  4. ; CHECK: %const = bitcast i128 12297829382473034410122878 to i128
  5. %1 = add i128 %a, 12297829382473034410122878
  6. %2 = add i128 %1, 12297829382473034410122878
  7. ret i128 %2
  8. }
  9. ; Check that we don't hoist the shift value of a shift instruction.
  10. define i512 @test2(i512 %a) nounwind {
  11. ; CHECK-LABEL: test2
  12. ; CHECK-NOT: %const = bitcast i512 504 to i512
  13. %1 = shl i512 %a, 504
  14. %2 = ashr i512 %1, 504
  15. ret i512 %2
  16. }
  17. ; Check that we don't hoist constants with a type larger than i128.
  18. define i196 @test3(i196 %a) nounwind {
  19. ; CHECK-LABEL: test3
  20. ; CHECK-NOT: %const = bitcast i196 2 to i196
  21. %1 = mul i196 %a, 2
  22. %2 = mul i196 %1, 2
  23. ret i196 %2
  24. }
  25. ; Check that we don't hoist immediates with small values.
  26. define i96 @test4(i96 %a) nounwind {
  27. ; CHECK-LABEL: test4
  28. ; CHECK-NOT: %const = bitcast i96 2 to i96
  29. %1 = mul i96 %a, 2
  30. %2 = add i96 %1, 2
  31. ret i96 %2
  32. }