From 068fd8098ca68acf4daf11ad723934c8fef65be2 Mon Sep 17 00:00:00 2001 From: Matt Pharr Date: Sat, 20 Jul 2013 11:19:10 -0700 Subject: [PATCH] Explicitly set armv7-eabi target triple on ARM. This lets the compiler generate FMA instructions, which seems desirable. --- ispc.cpp | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/ispc.cpp b/ispc.cpp index e4590b7e..887f6ca3 100644 --- a/ispc.cpp +++ b/ispc.cpp @@ -576,22 +576,26 @@ Target::SupportedTargetISAs() { std::string Target::GetTripleString() const { llvm::Triple triple; - // Start with the host triple as the default - triple.setTriple(llvm::sys::getDefaultTargetTriple()); - - // And override the arch in the host triple based on what the user - // specified. Here we need to deal with the fact that LLVM uses one - // naming convention for targets TargetRegistry, but wants some - // slightly different ones for the triple. TODO: is there a way to - // have it do this remapping, which would presumably be a bit less - // error prone? - if (m_arch == "x86") - triple.setArchName("i386"); - else if (m_arch == "x86-64") - triple.setArchName("x86_64"); - else - triple.setArchName(m_arch); + if (m_arch == "arm") { + triple.setTriple("armv7-eabi"); + } + else { + // Start with the host triple as the default + triple.setTriple(llvm::sys::getDefaultTargetTriple()); + // And override the arch in the host triple based on what the user + // specified. Here we need to deal with the fact that LLVM uses one + // naming convention for targets TargetRegistry, but wants some + // slightly different ones for the triple. TODO: is there a way to + // have it do this remapping, which would presumably be a bit less + // error prone? + if (m_arch == "x86") + triple.setArchName("i386"); + else if (m_arch == "x86-64") + triple.setArchName("x86_64"); + else + triple.setArchName(m_arch); + } return triple.str(); }