File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 11; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3
22; RUN: llc -mtriple=aarch64 -global-isel=0 -verify-machineinstrs %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-SD
33; RUN: llc -mtriple=aarch64 -global-isel=1 -verify-machineinstrs %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-GI
4+ ; RUN: llc -mtriple=aarch64 -global-isel=1 -mattr=+fullfp16,+bf16 -verify-machineinstrs %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-GI
45
56define float @fptrunc_f64_f32 (double %a ) {
67; CHECK-LABEL: fptrunc_f64_f32:
Original file line number Diff line number Diff line change @@ -2346,6 +2346,20 @@ void GlobalISelEmitter::emitRunCustomAction(raw_ostream &OS) {
23462346 << " }\n " ;
23472347}
23482348
2349+ bool hasBFloatType (const TreePatternNode &Node) {
2350+ for (unsigned I = 0 , E = Node.getNumTypes (); I < E; I++) {
2351+ auto Ty = Node.getType (I);
2352+ for (auto T : Ty)
2353+ if (T.second == MVT::bf16 ||
2354+ (T.second .isVector () && T.second .getScalarType () == MVT::bf16 ))
2355+ return true ;
2356+ }
2357+ for (const TreePatternNode &C : Node.children ())
2358+ if (hasBFloatType (C))
2359+ return true ;
2360+ return false ;
2361+ }
2362+
23492363void GlobalISelEmitter::run (raw_ostream &OS) {
23502364 if (!UseCoverageFile.empty ()) {
23512365 RuleCoverage = CodeGenCoverage ();
@@ -2382,6 +2396,13 @@ void GlobalISelEmitter::run(raw_ostream &OS) {
23822396
23832397 if (Pat.getGISelShouldIgnore ())
23842398 continue ; // skip without warning
2399+
2400+ // Skip any patterns containing BF16 types, as GISel cannot currently tell
2401+ // the difference between fp16 and bf16. FIXME: This can be removed once
2402+ // BF16 is supported properly.
2403+ if (hasBFloatType (Pat.getSrcPattern ()))
2404+ continue ;
2405+
23852406 auto MatcherOrErr = runOnPattern (Pat);
23862407
23872408 // The pattern analysis can fail, indicating an unsupported pattern.
You can’t perform that action at this time.
0 commit comments