select.ll 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. ; RUN: opt < %s -cost-model -analyze -mtriple=thumbv7-apple-ios6.0.0 -mcpu=swift | FileCheck %s
  2. target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"
  3. target triple = "thumbv7-apple-ios6.0.0"
  4. ; CHECK: casts
  5. define void @casts() {
  6. ; Scalar values
  7. ; CHECK: cost of 1 {{.*}} select
  8. %v1 = select i1 undef, i8 undef, i8 undef
  9. ; CHECK: cost of 1 {{.*}} select
  10. %v2 = select i1 undef, i16 undef, i16 undef
  11. ; CHECK: cost of 1 {{.*}} select
  12. %v3 = select i1 undef, i32 undef, i32 undef
  13. ; CHECK: cost of 2 {{.*}} select
  14. %v4 = select i1 undef, i64 undef, i64 undef
  15. ; CHECK: cost of 1 {{.*}} select
  16. %v5 = select i1 undef, float undef, float undef
  17. ; CHECK: cost of 1 {{.*}} select
  18. %v6 = select i1 undef, double undef, double undef
  19. ; Vector values
  20. ; CHECK: cost of 1 {{.*}} select
  21. %v7 = select <2 x i1> undef, <2 x i8> undef, <2 x i8> undef
  22. ; CHECK: cost of 1 {{.*}} select
  23. %v8 = select <4 x i1> undef, <4 x i8> undef, <4 x i8> undef
  24. ; CHECK: cost of 1 {{.*}} select
  25. %v9 = select <8 x i1> undef, <8 x i8> undef, <8 x i8> undef
  26. ; CHECK: cost of 1 {{.*}} select
  27. %v10 = select <16 x i1> undef, <16 x i8> undef, <16 x i8> undef
  28. ; CHECK: cost of 1 {{.*}} select
  29. %v11 = select <2 x i1> undef, <2 x i16> undef, <2 x i16> undef
  30. ; CHECK: cost of 1 {{.*}} select
  31. %v12 = select <4 x i1> undef, <4 x i16> undef, <4 x i16> undef
  32. ; CHECK: cost of 1 {{.*}} select
  33. %v13 = select <8 x i1> undef, <8 x i16> undef, <8 x i16> undef
  34. ; CHECK: cost of 40 {{.*}} select
  35. %v13b = select <16 x i1> undef, <16 x i16> undef, <16 x i16> undef
  36. ; CHECK: cost of 1 {{.*}} select
  37. %v14 = select <2 x i1> undef, <2 x i32> undef, <2 x i32> undef
  38. ; CHECK: cost of 1 {{.*}} select
  39. %v15 = select <4 x i1> undef, <4 x i32> undef, <4 x i32> undef
  40. ; CHECK: cost of 41 {{.*}} select
  41. %v15b = select <8 x i1> undef, <8 x i32> undef, <8 x i32> undef
  42. ; CHECK: cost of 82 {{.*}} select
  43. %v15c = select <16 x i1> undef, <16 x i32> undef, <16 x i32> undef
  44. ; CHECK: cost of 1 {{.*}} select
  45. %v16 = select <2 x i1> undef, <2 x i64> undef, <2 x i64> undef
  46. ; CHECK: cost of 19 {{.*}} select
  47. %v16a = select <4 x i1> undef, <4 x i64> undef, <4 x i64> undef
  48. ; CHECK: cost of 50 {{.*}} select
  49. %v16b = select <8 x i1> undef, <8 x i64> undef, <8 x i64> undef
  50. ; CHECK: cost of 100 {{.*}} select
  51. %v16c = select <16 x i1> undef, <16 x i64> undef, <16 x i64> undef
  52. ; CHECK: cost of 1 {{.*}} select
  53. %v17 = select <2 x i1> undef, <2 x float> undef, <2 x float> undef
  54. ; CHECK: cost of 1 {{.*}} select
  55. %v18 = select <4 x i1> undef, <4 x float> undef, <4 x float> undef
  56. ; CHECK: cost of 1 {{.*}} select
  57. %v19 = select <2 x i1> undef, <2 x double> undef, <2 x double> undef
  58. ; odd vectors get legalized and should have similar costs
  59. ; CHECK: cost of 1 {{.*}} select
  60. %v20 = select <1 x i1> undef, <1 x i32> undef, <1 x i32> undef
  61. ; CHECK: cost of 1 {{.*}} select
  62. %v21 = select <3 x i1> undef, <3 x float> undef, <3 x float> undef
  63. ; CHECK: cost of 4 {{.*}} select
  64. %v22 = select <5 x i1> undef, <5 x double> undef, <5 x double> undef
  65. ret void
  66. }