Bug 60874 - Mono doesn't generate single precision floating point instructions for ARMv7
Summary: Mono doesn't generate single precision floating point instructions for ARMv7
Alias: None
Product: Runtime
Classification: Mono
Component: JIT ()
Version: 5.4 (2017-06)
Hardware: Other Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2017-11-27 14:23 UTC by Kai Ruhnau
Modified: 2017-11-28 15:53 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Kai Ruhnau 2017-11-27 14:23:43 UTC
Maybe related: #1728

Mono JIT compiler version (tarball Mon Nov 27 14:20:58 CET 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       normal
        Notifications: epoll
        Architecture:  armel,vfp+hard
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            sgen (concurrent by default)

My test method is

public float Foo(int bar) => bar / 125f;

The generated code (mono --aot -O=all, objdump -D) is

   773c8:	e92d4100 	push	{r8, lr}
   773cc:	e24dd018 	sub	sp, sp, #24
   773d0:	e58d0010 	str	r0, [sp, #16]
   773d4:	e58d1014 	str	r1, [sp, #20]
   773d8:	e59d0014 	ldr	r0, [sp, #20]
   773dc:	ed8deb00 	vstr	d14, [sp]
   773e0:	ee0e0a10 	vmov	s28, r0
   773e4:	eeb8eace 	vcvt.f32.s32	s28, s28
   773e8:	eeb70ace 	vcvt.f64.f32	d0, s28
   773ec:	ed9deb00 	vldr	d14, [sp]
   773f0:	ed9f1a00 	vldr	s2, [pc]	; 773f8 <...+0x30>
   773f4:	ea000000 	b	773fc <...+0x34>
   773f8:	42fa0000 	rscsmi	r0, sl, #0
   773fc:	eeb71ac1 	vcvt.f64.f32	d1, s2
   77400:	ee800b01 	vdiv.f64	d0, d0, d1
   77404:	eeb70bc0 	vcvt.f32.f64	s0, d0
   77408:	e28dd018 	add	sp, sp, #24
   7740c:	e8bd8100 	pop	{r8, pc}

which has an awful lot of stuff going compared to the minimum that's possible
Comment 1 Rodrigo Kumpera 2017-11-27 19:07:22 UTC
You can pass -O=float32 to enable it.

We should consider making this the default.
Comment 2 Kai Ruhnau 2017-11-28 15:53:01 UTC
Thanks, that flag improves the code generation a lot. I'm a strong proponent of turning it on by default.