Index: lib/Target/ARM/ARMInstrVFP.td =================================================================== --- lib/Target/ARM/ARMInstrVFP.td +++ lib/Target/ARM/ARMInstrVFP.td @@ -594,9 +594,9 @@ } def VCMPEZH : AHuI<0b11101, 0b11, 0b0101, 0b11, 0, - (outs), (ins SPR:$Sd), + (outs), (ins HPR:$Sd), IIC_fpCMP16, "vcmpe", ".f16\t$Sd, #0", - []> { + [(arm_cmpfp0 HPR:$Sd, (i32 1))]> { let Inst{3-0} = 0b0000; let Inst{5} = 0; } Index: test/CodeGen/ARM/fp16-instructions.ll =================================================================== --- test/CodeGen/ARM/fp16-instructions.ll +++ test/CodeGen/ARM/fp16-instructions.ll @@ -104,43 +104,47 @@ %2 = bitcast float %G.coerce to i32 %tmp1.0.extract.trunc = trunc i32 %2 to i16 %3 = bitcast i16 %tmp1.0.extract.trunc to half - %cmp = fcmp ogt half %1, %3 + %cmp = fcmp une half %1, %3 ret i1 %cmp ; CHECK-LABEL: VCMP: -; CHECK-SOFT: bl __aeabi_fcmpgt +; CHECK-SOFT: bl __aeabi_fcmpeq ; CHECK-SOFTFP-VFP3: bl __aeabi_h2f ; CHECK-SOFTFP-VFP3: bl __aeabi_h2f -; CHECK-SOFTFP-VFP3: vcmpe.f32 s{{.}}, s{{.}} +; CHECK-SOFTFP-VFP3: vcmp.f32 s{{.}}, s{{.}} ; CHECK-SOFTFP-FP16: vcvtb.f32.f16 s{{.}}, s{{.}} ; CHECK-SOFTFP-FP16: vcvtb.f32.f16 s{{.}}, s{{.}} -; CHECK-SOFTFP-FP16: vcmpe.f32 s{{.}}, s{{.}} +; CHECK-SOFTFP-FP16: vcmp.f32 s{{.}}, s{{.}} ; CHECK-SOFTFP-FULLFP16: vmov.f16 [[S2:s[0-9]]], r0 ; CHECK-SOFTFP-FULLFP16: vmov.f16 [[S0:s[0-9]]], r1 -; CHECK-SOFTFP-FULLFP16: vcmpe.f16 [[S2]], [[S0]] +; CHECK-SOFTFP-FULLFP16: vcmp.f16 [[S2]], [[S0]] ; CHECK-SOFTFP-FULLFP16-NOT: vmov.f16 s{{.}}, r0 ; CHECK-SOFTFP-FULLFP16-NOT: vmov.f16 s{{.}}, r1 -; CHECK-HARDFP-FULLFP16: vcmpe.f16 s0, s1 +; CHECK-HARDFP-FULLFP16: vcmp.f16 s0, s1 } ; 4. VCMPE +define i32 @VCMPE_IMM(float %F.coerce) { +entry: + %0 = bitcast float %F.coerce to i32 + %tmp.0.extract.trunc = trunc i32 %0 to i16 + %1 = bitcast i16 %tmp.0.extract.trunc to half + %tmp = fcmp olt half %1, 0.000000e+00 + %tmp1 = zext i1 %tmp to i32 + ret i32 %tmp1 -; FIXME: enable when constant pool is fixed -; -;define i32 @VCMPE_IMM(float %F.coerce) { -;entry: -; %0 = bitcast float %F.coerce to i32 -; %tmp.0.extract.trunc = trunc i32 %0 to i16 -; %1 = bitcast i16 %tmp.0.extract.trunc to half -; %tmp = fcmp olt half %1, 1.000000e+00 -; %tmp1 = zext i1 %tmp to i32 -; ret i32 %tmp1 -;} +; CHECK-LABEL: VCMPE_IMM: + +; CHECK-SOFT: bl __aeabi_fcmplt +; CHECK-SOFTFP-FP16: vcmpe.f32 s0, #0 +; CHECK-SOFTFP-FULLFP16: vcmpe.f16 s0, #0 +; CHECK-HARDFP-FULLFP16: vcmpe.f16 s0, #0 +} define i32 @VCMPE(float %F.coerce, float %G.coerce) { entry: @@ -155,6 +159,11 @@ ret i32 %tmp1 ; CHECK-LABEL: VCMPE: + +; CHECK-SOFT: bl __aeabi_fcmplt +; CHECK-SOFTFP-FP16: vcmpe.f32 s{{.}}, s{{.}} +; CHECK-SOFTFP-FULLFP16: vcmpe.f16 s{{.}}, s{{.}} +; CHECK-HARDFP-FULLFP16: vcmpe.f16 s{{.}}, s{{.}} } ; 5. VCVT (between floating-point and fixed-point)