[llvm] r245231 - [ARM] Fix crash when targetting CPU without NEON

James Molloy via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 17 12:37:12 PDT 2015


Author: jamesm
Date: Mon Aug 17 14:37:12 2015
New Revision: 245231

URL: http://llvm.org/viewvc/llvm-project?rev=245231&view=rev
Log:
[ARM] Fix crash when targetting CPU without NEON

We emulate a scalar vmin/vmax with NEON instructions as they don't exist in the VFP ISA. So only mark these as legal when NEON is available.

Found here: https://code.google.com/p/chromium/issues/detail?id=521671

Modified:
    llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
    llvm/trunk/test/CodeGen/ARM/neon_minmax.ll

Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=245231&r1=245230&r2=245231&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Aug 17 14:37:12 2015
@@ -950,11 +950,11 @@ ARMTargetLowering::ARMTargetLowering(con
     }
   }
 
-  if (Subtarget->hasVFP3()) {
+  if (Subtarget->hasNEON()) {
+    // vmin and vmax aren't available in a scalar form, so we use
+    // a NEON instruction with an undef lane instead.
     setOperationAction(ISD::FMINNAN, MVT::f32, Legal);
     setOperationAction(ISD::FMAXNAN, MVT::f32, Legal);
-  }
-  if (Subtarget->hasNEON()) {
     setOperationAction(ISD::FMINNAN, MVT::v2f32, Legal);
     setOperationAction(ISD::FMAXNAN, MVT::v2f32, Legal);
     setOperationAction(ISD::FMINNAN, MVT::v4f32, Legal);

Modified: llvm/trunk/test/CodeGen/ARM/neon_minmax.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/neon_minmax.ll?rev=245231&r1=245230&r2=245231&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/neon_minmax.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/neon_minmax.ll Mon Aug 17 14:37:12 2015
@@ -1,4 +1,5 @@
 ; RUN: llc -mtriple=arm-eabi -mcpu=swift %s -o - | FileCheck %s
+; RUN: llc -mtriple=arm-eabi -mcpu=cortex-a8 -mattr=-neon %s -o -
 
 define float @fmin_ole(float %x) nounwind {
 ;CHECK-LABEL: fmin_ole:




More information about the llvm-commits mailing list