diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
--- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -7256,6 +7256,8 @@
     return getSVESafeBitCast(VT, IntResult, DAG);
   }
 
+  if (!Subtarget->hasNEON())
+    return SDValue();
   if (SrcVT.bitsLT(VT))
     In2 = DAG.getNode(ISD::FP_EXTEND, DL, VT, In2);
   else if (SrcVT.bitsGT(VT))
diff --git a/llvm/test/CodeGen/AArch64/fcopysign.ll b/llvm/test/CodeGen/AArch64/fcopysign.ll
--- a/llvm/test/CodeGen/AArch64/fcopysign.ll
+++ b/llvm/test/CodeGen/AArch64/fcopysign.ll
@@ -1,10 +1,13 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc -o - %s | FileCheck %s
+; RUN: llc < %s -mtriple aarch64-none-eabi | FileCheck %s
+; RUN: llc < %s -mtriple aarch64-none-eabi -mattr -neon | FileCheck -check-prefix=CHECK-NONEON %s
 ; Check that selection dag legalization of fcopysign works in cases with
 ; different modes for the arguments.
-target triple = "aarch64--"
 
 declare fp128 @llvm.copysign.f128(fp128, fp128)
+declare float @llvm.copysign.f64(float %a, float %b)
+declare float @llvm.copysign.f32(float %a, float %b)
+declare float @llvm.copysign.f16(float %a, float %b)
 
 @val_float = dso_local global float zeroinitializer, align 4
 @val_double = dso_local global double zeroinitializer, align 8
@@ -26,6 +29,22 @@
 ; CHECK-NEXT:    strb w8, [sp, #15]
 ; CHECK-NEXT:    ldr q0, [sp], #16
 ; CHECK-NEXT:    ret
+;
+; CHECK-NONEON-LABEL: copysign0:
+; CHECK-NONEON:       // %bb.0: // %entry
+; CHECK-NONEON-NEXT:    .cfi_def_cfa_offset 16
+; CHECK-NONEON-NEXT:    adrp x8, .LCPI0_0
+; CHECK-NONEON-NEXT:    ldr q0, [x8, :lo12:.LCPI0_0]
+; CHECK-NONEON-NEXT:    adrp x8, val_double
+; CHECK-NONEON-NEXT:    str q0, [sp, #-16]!
+; CHECK-NONEON-NEXT:    ldr x8, [x8, :lo12:val_double]
+; CHECK-NONEON-NEXT:    ldrb w9, [sp, #15]
+; CHECK-NONEON-NEXT:    and x8, x8, #0x8000000000000000
+; CHECK-NONEON-NEXT:    lsr x8, x8, #56
+; CHECK-NONEON-NEXT:    bfxil w8, w9, #0, #7
+; CHECK-NONEON-NEXT:    strb w8, [sp, #15]
+; CHECK-NONEON-NEXT:    ldr q0, [sp], #16
+; CHECK-NONEON-NEXT:    ret
 entry:
   %v = load double, double* @val_double, align 8
   %conv = fpext double %v to fp128
@@ -49,6 +68,22 @@
 ; CHECK-NEXT:    strb w8, [sp, #15]
 ; CHECK-NEXT:    ldr q0, [sp], #16
 ; CHECK-NEXT:    ret
+;
+; CHECK-NONEON-LABEL: copysign1:
+; CHECK-NONEON:       // %bb.0: // %entry
+; CHECK-NONEON-NEXT:    .cfi_def_cfa_offset 16
+; CHECK-NONEON-NEXT:    adrp x8, val_fp128
+; CHECK-NONEON-NEXT:    ldr q0, [x8, :lo12:val_fp128]
+; CHECK-NONEON-NEXT:    adrp x8, val_float
+; CHECK-NONEON-NEXT:    str q0, [sp, #-16]!
+; CHECK-NONEON-NEXT:    ldr w8, [x8, :lo12:val_float]
+; CHECK-NONEON-NEXT:    ldrb w9, [sp, #15]
+; CHECK-NONEON-NEXT:    and w8, w8, #0x80000000
+; CHECK-NONEON-NEXT:    lsr w8, w8, #24
+; CHECK-NONEON-NEXT:    bfxil w8, w9, #0, #7
+; CHECK-NONEON-NEXT:    strb w8, [sp, #15]
+; CHECK-NONEON-NEXT:    ldr q0, [sp], #16
+; CHECK-NONEON-NEXT:    ret
 entry:
   %v0 = load fp128, fp128* @val_fp128, align 16
   %v1 = load float, float* @val_float, align 4
@@ -56,3 +91,72 @@
   %call = tail call fp128 @llvm.copysign.f128(fp128 %v0, fp128 %conv)
   ret fp128 %call
 }
+
+define float @copysign64(float %a, float %b) {
+; CHECK-LABEL: copysign64:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    movi v2.4s, #128, lsl #24
+; CHECK-NEXT:    // kill: def $s0 killed $s0 def $q0
+; CHECK-NEXT:    // kill: def $s1 killed $s1 def $q1
+; CHECK-NEXT:    bit v0.16b, v1.16b, v2.16b
+; CHECK-NEXT:    // kill: def $s0 killed $s0 killed $q0
+; CHECK-NEXT:    ret
+;
+; CHECK-NONEON-LABEL: copysign64:
+; CHECK-NONEON:       // %bb.0: // %entry
+; CHECK-NONEON-NEXT:    fabs s0, s0
+; CHECK-NONEON-NEXT:    fmov w8, s1
+; CHECK-NONEON-NEXT:    tst w8, #0x80000000
+; CHECK-NONEON-NEXT:    fneg s2, s0
+; CHECK-NONEON-NEXT:    fcsel s0, s2, s0, ne
+; CHECK-NONEON-NEXT:    ret
+entry:
+  %c = call float @llvm.copysign.f64(float %a, float %b)
+  ret float %c
+}
+
+define float @copysign32(float %a, float %b) {
+; CHECK-LABEL: copysign32:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    movi v2.4s, #128, lsl #24
+; CHECK-NEXT:    // kill: def $s0 killed $s0 def $q0
+; CHECK-NEXT:    // kill: def $s1 killed $s1 def $q1
+; CHECK-NEXT:    bit v0.16b, v1.16b, v2.16b
+; CHECK-NEXT:    // kill: def $s0 killed $s0 killed $q0
+; CHECK-NEXT:    ret
+;
+; CHECK-NONEON-LABEL: copysign32:
+; CHECK-NONEON:       // %bb.0: // %entry
+; CHECK-NONEON-NEXT:    fabs s0, s0
+; CHECK-NONEON-NEXT:    fmov w8, s1
+; CHECK-NONEON-NEXT:    tst w8, #0x80000000
+; CHECK-NONEON-NEXT:    fneg s2, s0
+; CHECK-NONEON-NEXT:    fcsel s0, s2, s0, ne
+; CHECK-NONEON-NEXT:    ret
+entry:
+  %c = call float @llvm.copysign.f32(float %a, float %b)
+  ret float %c
+}
+
+define float @copysign16(float %a, float %b) {
+; CHECK-LABEL: copysign16:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    movi v2.4s, #128, lsl #24
+; CHECK-NEXT:    // kill: def $s0 killed $s0 def $q0
+; CHECK-NEXT:    // kill: def $s1 killed $s1 def $q1
+; CHECK-NEXT:    bit v0.16b, v1.16b, v2.16b
+; CHECK-NEXT:    // kill: def $s0 killed $s0 killed $q0
+; CHECK-NEXT:    ret
+;
+; CHECK-NONEON-LABEL: copysign16:
+; CHECK-NONEON:       // %bb.0: // %entry
+; CHECK-NONEON-NEXT:    fabs s0, s0
+; CHECK-NONEON-NEXT:    fmov w8, s1
+; CHECK-NONEON-NEXT:    tst w8, #0x80000000
+; CHECK-NONEON-NEXT:    fneg s2, s0
+; CHECK-NONEON-NEXT:    fcsel s0, s2, s0, ne
+; CHECK-NONEON-NEXT:    ret
+entry:
+  %c = call float @llvm.copysign.f16(float %a, float %b)
+  ret float %c
+}