1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -verify-machineinstrs -mtriple powerpc64le -mcpu=pwr9 | FileCheck %s
3 ; RUN: llc < %s -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff -vec-extabi -mcpu=pwr9 | FileCheck %s
4 ; RUN: opt < %s -passes="default<O3>" -S -mtriple powerpc64le -mcpu=pwr9 | FileCheck %s --check-prefix=OPT
8 ; CHECK: # %bb.0: # %entry
9 ; CHECK-NEXT: darn 3, 2
12 %0 = call i64 @llvm.ppc.darnraw()
16 define i64 @conditioned() {
17 ; CHECK-LABEL: conditioned:
18 ; CHECK: # %bb.0: # %entry
19 ; CHECK-NEXT: darn 3, 1
22 %0 = call i64 @llvm.ppc.darn()
26 define signext i32 @word() {
28 ; CHECK: # %bb.0: # %entry
29 ; CHECK-NEXT: darn 3, 0
30 ; CHECK-NEXT: extsw 3, 3
33 %0 = call i32 @llvm.ppc.darn32()
37 define i64 @darn_side_effect() {
38 ; CHECK-LABEL: darn_side_effect:
39 ; CHECK: # %bb.0: # %entry
40 ; CHECK-NEXT: darn 3, 2
41 ; CHECK-NEXT: darn 3, 1
44 ; OPT-LABEL: @darn_side_effect
45 ; OPT: call i64 @llvm.ppc.darnraw()
46 ; OPT-NEXT: call i64 @llvm.ppc.darn()
48 %0 = call i64 @llvm.ppc.darnraw()
49 %1 = call i64 @llvm.ppc.darn()
53 define void @darn_loop(ptr noundef %darn) {
54 ; OPT-LABEL: @darn_loop
55 ; OPT-COUNT-32: tail call i64 @llvm.ppc.darn()
57 %inc = alloca i32, align 4
58 store i32 0, ptr %inc, align 4
62 %0 = load i32, ptr %inc, align 4
63 %cmp = icmp ne i32 %0, 32
64 br i1 %cmp, label %body, label %end_loop
67 %1 = call i64 @llvm.ppc.darn()
68 %2 = load i32, ptr %inc, align 4
69 %idx = getelementptr inbounds i64, ptr %darn, i32 %2
70 store i64 %1, ptr %idx, align 8
74 %3 = load i32, ptr %inc, align 4
75 %ninc = add nsw i32 %3, 1
76 store i32 %ninc, ptr %inc, align 4
83 declare i64 @llvm.ppc.darn()
84 declare i64 @llvm.ppc.darnraw()
85 declare i32 @llvm.ppc.darn32()