Skip to content

Ferny730JR/CS4390Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fused Multiply Add Project

An LLVM Fused Multiply-Add (FMA) Optimization Pass

Introduction

An LLVM pass to detect and transform sequences of separate FMUL and FADD instructions into a single fused multiply-add instruction (FMA), if the target hardware supports it.

Table of Contents

  1. Compilation
  2. Usage
  3. Tests

Compilation

FMA Optimization

To be able to compile the FMA optimization pass, you can run the following:

clang++ -std=17 -fPIC \
    -shared FusedMultiplyAdd.cpp -o libFMA.dylib \
    $(llvm-config --cxxflags --ldflags) -lLLVM

Tests to LLVM IR

To be able to compile the C sources (tests) to LLVM IR:

clang -O0 -Xclang -disable-O0-optnone -S -emit-llvm \
    test.c -o test.ll

Optionally, you can run an opt pass to promote allocations to registers:

opt -passes=mem2reg test.ll -S -o test_simplified.ll

Usage

To run the FMA optimization pass on a test file:

opt -load-pass-plugin=./libFMA.dylib \
    -passes=fma \
    your_ir.ll -S -o your_ir_optimized.ll

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors