@@ -60,44 +60,30 @@ return:
60
60
ret i32 %p
61
61
}
62
62
63
- ; Check that switch's of powers of two range is not reduced if default case is reachable,
64
- ; unless Zbb extension is on.
63
+ ; Check that switch's of powers of two range is not reduced if default case is reachable
65
64
define i32 @switch_of_powers_reachable_default (i32 %x ) {
66
- ; RV64I-LABEL: @switch_of_powers_reachable_default(
67
- ; RV64I-NEXT: entry:
68
- ; RV64I-NEXT: switch i32 [[X:%.*]], label [[RETURN:%.*]] [
69
- ; RV64I-NEXT: i32 1, label [[BB1:%.*]]
70
- ; RV64I-NEXT: i32 8, label [[BB2:%.*]]
71
- ; RV64I-NEXT: i32 16, label [[BB3:%.*]]
72
- ; RV64I-NEXT: i32 32, label [[BB4:%.*]]
73
- ; RV64I-NEXT: i32 64, label [[BB5:%.*]]
74
- ; RV64I-NEXT: ]
75
- ; RV64I: bb1:
76
- ; RV64I-NEXT: br label [[RETURN]]
77
- ; RV64I: bb2:
78
- ; RV64I-NEXT: br label [[RETURN]]
79
- ; RV64I: bb3:
80
- ; RV64I-NEXT: br label [[RETURN]]
81
- ; RV64I: bb4:
82
- ; RV64I-NEXT: br label [[RETURN]]
83
- ; RV64I: bb5:
84
- ; RV64I-NEXT: br label [[RETURN]]
85
- ; RV64I: return:
86
- ; RV64I-NEXT: [[P:%.*]] = phi i32 [ 3, [[BB1]] ], [ 2, [[BB2]] ], [ 1, [[BB3]] ], [ 0, [[BB4]] ], [ 42, [[BB5]] ], [ -1, [[ENTRY:%.*]] ]
87
- ; RV64I-NEXT: ret i32 [[P]]
88
- ;
89
- ; RV64ZBB-LABEL: @switch_of_powers_reachable_default(
90
- ; RV64ZBB-NEXT: entry:
91
- ; RV64ZBB-NEXT: [[TMP0:%.*]] = call i32 @llvm.cttz.i32(i32 [[X:%.*]], i1 true)
92
- ; RV64ZBB-NEXT: [[TMP1:%.*]] = icmp ult i32 [[TMP0]], 7
93
- ; RV64ZBB-NEXT: br i1 [[TMP1]], label [[SWITCH_LOOKUP:%.*]], label [[RETURN:%.*]]
94
- ; RV64ZBB: switch.lookup:
95
- ; RV64ZBB-NEXT: [[SWITCH_GEP:%.*]] = getelementptr inbounds [7 x i32], ptr @switch.table.switch_of_powers_reachable_default, i32 0, i32 [[TMP0]]
96
- ; RV64ZBB-NEXT: [[SWITCH_LOAD:%.*]] = load i32, ptr [[SWITCH_GEP]], align 4
97
- ; RV64ZBB-NEXT: br label [[RETURN]]
98
- ; RV64ZBB: return:
99
- ; RV64ZBB-NEXT: [[P:%.*]] = phi i32 [ [[SWITCH_LOAD]], [[SWITCH_LOOKUP]] ], [ -1, [[ENTRY:%.*]] ]
100
- ; RV64ZBB-NEXT: ret i32 [[P]]
65
+ ; CHECK-LABEL: @switch_of_powers_reachable_default(
66
+ ; CHECK-NEXT: entry:
67
+ ; CHECK-NEXT: switch i32 [[X:%.*]], label [[RETURN:%.*]] [
68
+ ; CHECK-NEXT: i32 1, label [[BB1:%.*]]
69
+ ; CHECK-NEXT: i32 8, label [[BB2:%.*]]
70
+ ; CHECK-NEXT: i32 16, label [[BB3:%.*]]
71
+ ; CHECK-NEXT: i32 32, label [[BB4:%.*]]
72
+ ; CHECK-NEXT: i32 64, label [[BB5:%.*]]
73
+ ; CHECK-NEXT: ]
74
+ ; CHECK: bb1:
75
+ ; CHECK-NEXT: br label [[RETURN]]
76
+ ; CHECK: bb2:
77
+ ; CHECK-NEXT: br label [[RETURN]]
78
+ ; CHECK: bb3:
79
+ ; CHECK-NEXT: br label [[RETURN]]
80
+ ; CHECK: bb4:
81
+ ; CHECK-NEXT: br label [[RETURN]]
82
+ ; CHECK: bb5:
83
+ ; CHECK-NEXT: br label [[RETURN]]
84
+ ; CHECK: return:
85
+ ; CHECK-NEXT: [[P:%.*]] = phi i32 [ 3, [[BB1]] ], [ 2, [[BB2]] ], [ 1, [[BB3]] ], [ 0, [[BB4]] ], [ 42, [[BB5]] ], [ -1, [[ENTRY:%.*]] ]
86
+ ; CHECK-NEXT: ret i32 [[P]]
101
87
;
102
88
entry:
103
89
switch i32 %x , label %default_case [
0 commit comments