large-immediate.ll 774 B

123456789101112131415161718192021222324252627
  1. ; RUN: opt -mtriple=arm64-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 large, but cheap constants
  10. define i512 @test2(i512 %a) nounwind {
  11. ; CHECK-LABEL: test2
  12. ; CHECK-NOT: %const = bitcast i512 7 to i512
  13. %1 = and i512 %a, 7
  14. %2 = or i512 %1, 7
  15. ret i512 %2
  16. }
  17. ; Check that we don't hoist the shift value of a shift instruction.
  18. define i512 @test3(i512 %a) nounwind {
  19. ; CHECK-LABEL: test3
  20. ; CHECK-NOT: %const = bitcast i512 504 to i512
  21. %1 = shl i512 %a, 504
  22. %2 = ashr i512 %1, 504
  23. ret i512 %2
  24. }