File tree 2 files changed +30
-2
lines changed
2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -200,7 +200,8 @@ class CoalesceFeaturesAndStripAtomics final : public ModulePass {
200
200
bool runOnModule (Module &M) override {
201
201
FeatureBitset Features = coalesceFeatures (M);
202
202
203
- std::string FeatureStr = getFeatureString (Features);
203
+ std::string FeatureStr =
204
+ getFeatureString (Features, WasmTM->getTargetFeatureString ());
204
205
WasmTM->setTargetFeatureString (FeatureStr);
205
206
for (auto &F : M)
206
207
replaceFeatures (F, FeatureStr);
@@ -238,12 +239,17 @@ class CoalesceFeaturesAndStripAtomics final : public ModulePass {
238
239
return Features;
239
240
}
240
241
241
- std::string getFeatureString (const FeatureBitset &Features) {
242
+ static std::string getFeatureString (const FeatureBitset &Features,
243
+ StringRef TargetFS) {
242
244
std::string Ret;
243
245
for (const SubtargetFeatureKV &KV : WebAssemblyFeatureKV) {
244
246
if (Features[KV.Value ])
245
247
Ret += (StringRef (" +" ) + KV.Key + " ," ).str ();
246
248
}
249
+ SubtargetFeatures TF{TargetFS};
250
+ for (std::string const &F : TF.getFeatures ())
251
+ if (!SubtargetFeatures::isEnabled (F))
252
+ Ret += F;
247
253
return Ret;
248
254
}
249
255
Original file line number Diff line number Diff line change
1
+ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2
+ ; RUN: llc < %s -mattr=-sign-ext | FileCheck %s
3
+
4
+ target triple = "wasm32-unknown-unknown"
5
+
6
+ define i8 @ashr (i8 %v , i8 %x ) {
7
+ ; CHECK-LABEL: ashr:
8
+ ; CHECK: .functype ashr (i32, i32) -> (i32)
9
+ ; CHECK-NEXT: # %bb.0:
10
+ ; CHECK-NEXT: local.get 0
11
+ ; CHECK-NEXT: i32.const 24
12
+ ; CHECK-NEXT: i32.shl
13
+ ; CHECK-NEXT: i32.const 24
14
+ ; CHECK-NEXT: i32.shr_s
15
+ ; CHECK-NEXT: local.get 1
16
+ ; CHECK-NEXT: i32.const 255
17
+ ; CHECK-NEXT: i32.and
18
+ ; CHECK-NEXT: i32.shr_s
19
+ ; CHECK-NEXT: # fallthrough-return
20
+ %a = ashr i8 %v , %x
21
+ ret i8 %a
22
+ }
You can’t perform that action at this time.
0 commit comments