scalarize.ll 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. ; RUN: opt < %s -cost-model -analyze -mtriple=i386 -mcpu=corei7-avx | FileCheck %s -check-prefix=CHECK32
  2. ; RUN: opt < %s -cost-model -analyze -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx | FileCheck %s -check-prefix=CHECK64
  3. ; Test vector scalarization costs.
  4. ; RUN: llc < %s -march=x86 -mcpu=i386
  5. ; RUN: llc < %s -march=x86 -mcpu=yonah
  6. %i4 = type <4 x i32>
  7. %i8 = type <2 x i64>
  8. ;;; TEST HANDLING OF VARIOUS VECTOR SIZES
  9. declare %i4 @llvm.bswap.v4i32(%i4)
  10. declare %i8 @llvm.bswap.v2i64(%i8)
  11. declare %i4 @llvm.ctpop.v4i32(%i4)
  12. declare %i8 @llvm.ctpop.v2i64(%i8)
  13. ; CHECK32-LABEL: test_scalarized_intrinsics
  14. ; CHECK64-LABEL: test_scalarized_intrinsics
  15. define void @test_scalarized_intrinsics() {
  16. %r1 = add %i8 undef, undef
  17. ; CHECK32: cost of 12 {{.*}}bswap.v4i32
  18. ; CHECK64: cost of 12 {{.*}}bswap.v4i32
  19. %r2 = call %i4 @llvm.bswap.v4i32(%i4 undef)
  20. ; CHECK32: cost of 10 {{.*}}bswap.v2i64
  21. ; CHECK64: cost of 6 {{.*}}bswap.v2i64
  22. %r3 = call %i8 @llvm.bswap.v2i64(%i8 undef)
  23. ; CHECK32: cost of 12 {{.*}}ctpop.v4i32
  24. ; CHECK64: cost of 12 {{.*}}ctpop.v4i32
  25. %r4 = call %i4 @llvm.ctpop.v4i32(%i4 undef)
  26. ; CHECK32: cost of 10 {{.*}}ctpop.v2i64
  27. ; CHECK64: cost of 6 {{.*}}ctpop.v2i64
  28. %r5 = call %i8 @llvm.ctpop.v2i64(%i8 undef)
  29. ; CHECK32: ret
  30. ; CHECK64: ret
  31. ret void
  32. }