Skip to content

Commit

Permalink
add end to end test for fmf
Browse files Browse the repository at this point in the history
  • Loading branch information
vchuravy committed Dec 26, 2019
1 parent b17caba commit 79ce5ca
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/llvmpasses/fmf.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license
# REQUIRES: x86_64
# RUN: julia --startup-file=no %s %t -O && llvm-link -S %t/* -o %t/module.ll
# RUN: cat %t/module.ll | llc - -mtriple=x86_64-- -mattr=fma | FileCheck %s

## Notes:
# This script uses the `emit` function (defined llvmpasses.jl) to emit either
# optimized or unoptimized LLVM IR. Each function is emitted individually and
# `llvm-link` is used to create a single module that can be passed to opt.
# The order in which files are emitted and linked is important since `lit` will
# process the test cases in order.

include(joinpath("..", "testhelpers", "llvmpasses.jl"))

# CHECK-LABEL: julia_dotf_
function dotf(a, b)
s = 0.0
@inbounds @simd for i eachindex(a)
# CHECK: vfmadd231pd
# CHECK-NEXT: vfmadd231pd
# CHECK-NEXT: vfmadd231pd
# CHECK-NEXT: vfmadd231pd
s += a[i] * b[i]
end
s
end

emit(dotf, Vector{Float64}, Vector{Float64})
3 changes: 3 additions & 0 deletions test/llvmpasses/lit.cfg → test/llvmpasses/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@
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']))
config.environment['PATH'] = path
config.environment['HOME'] = "/tmp"

if platform.machine() == "x86_64":
config.available_features.add('x86_64')

0 comments on commit 79ce5ca

Please sign in to comment.