[llvm] [X86, SimplifyCFG] Support hoisting load/store with conditional faulting (Part I) (PR #96878)
Shengchen Kan via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 5 05:04:59 PDT 2024
================
@@ -0,0 +1,34 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=x86_64 -mattr=+cf | FileCheck %s
+
+;; Test masked.load/store.v1* is generated in simplifycfg and not falls back to branch+load/store in following passes.
+define void @basic(i1 %cond, ptr %b, ptr %p, ptr %q) {
+; CHECK-LABEL: basic:
+; CHECK: # %bb.0: # %entry
+; CHECK-NEXT: andb $1, %dil
+; CHECK-NEXT: negb %dil
+; CHECK-NEXT: cfcmovnew (%rdx), %ax
+; CHECK-NEXT: cfcmovnel (%rcx), %edi
+; CHECK-NEXT: cfcmovneq (%rsi), %r8
+; CHECK-NEXT: cfcmovnew %ax, (%rsi)
+; CHECK-NEXT: cfcmovnel %edi, (%rdx)
+; CHECK-NEXT: cfcmovneq %r8, (%rcx)
+; CHECK-NEXT: retq
+entry:
+ br i1 %cond, label %if.true, label %if.false
+
+if.false:
+ br label %if.end
+
+if.true:
+ %0 = load i16, ptr %p, align 2
+ %1 = load i32, ptr %q, align 4
+ %2 = load i64, ptr %b, align 8
+ store i16 %0, ptr %b, align 2
+ store i32 %1, ptr %p, align 4
+ store i64 %2, ptr %q, align 8
+ br label %if.false
+
+if.end:
+ ret void
+}
----------------
KanRobert wrote:
Done.
https://github.com/llvm/llvm-project/pull/96878
More information about the llvm-commits
mailing list