Skip to content

Commit 79ce5ca

Browse files
committed
add end to end test for fmf
1 parent b17caba commit 79ce5ca

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

test/llvmpasses/fmf.jl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This file is a part of Julia. License is MIT: https://julialang.org/license
2+
# REQUIRES: x86_64
3+
# RUN: julia --startup-file=no %s %t -O && llvm-link -S %t/* -o %t/module.ll
4+
# RUN: cat %t/module.ll | llc - -mtriple=x86_64-- -mattr=fma | FileCheck %s
5+
6+
## Notes:
7+
# This script uses the `emit` function (defined llvmpasses.jl) to emit either
8+
# optimized or unoptimized LLVM IR. Each function is emitted individually and
9+
# `llvm-link` is used to create a single module that can be passed to opt.
10+
# The order in which files are emitted and linked is important since `lit` will
11+
# process the test cases in order.
12+
13+
include(joinpath("..", "testhelpers", "llvmpasses.jl"))
14+
15+
# CHECK-LABEL: julia_dotf_
16+
function dotf(a, b)
17+
s = 0.0
18+
@inbounds @simd for i eachindex(a)
19+
# CHECK: vfmadd231pd
20+
# CHECK-NEXT: vfmadd231pd
21+
# CHECK-NEXT: vfmadd231pd
22+
# CHECK-NEXT: vfmadd231pd
23+
s += a[i] * b[i]
24+
end
25+
s
26+
end
27+
28+
emit(dotf, Vector{Float64}, Vector{Float64})

test/llvmpasses/lit.cfg renamed to test/llvmpasses/lit.cfg.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@
1616
path = os.path.pathsep.join((os.path.join(os.path.dirname(__file__),"../../usr/tools"), os.path.join(os.path.dirname(__file__),"../../usr/bin"), config.environment['PATH']))
1717
config.environment['PATH'] = path
1818
config.environment['HOME'] = "/tmp"
19+
20+
if platform.machine() == "x86_64":
21+
config.available_features.add('x86_64')

0 commit comments

Comments
 (0)