r200233 - Cortex-M3 and Cortex-M4 should not enable hwdiv-arm

Artyom Skrobov Artyom.Skrobov at arm.com
Wed Jan 29 02:02:18 PST 2014

> There are a limited number of clang tests that check generated
> assembly in test/CodeGen, if you want to go that path, but it
> needs something like "// REQUIRES: arm-registered-target".
> Testing generated assembly from clang is generally discouraged,
> though, for better or worse.

OK -- re-committed as r200385, with the test in test/CodeGen and with the "REQUIRES:" line.

> You could also do a purely semantic test like (untested):
> // test/Sema/arm-cortex-cpus.c
> // RUN: %clang_cc1 -target arm-linux-gnueabi -mcpu=cortex-m4 -verify
> // expected-no-diagnostics
> #ifndef __ARM_ARCH_EXT_IDIV__
> # error "hwdiv wasn't set for cortex-m4!"
> #endif

Such a test already existed (in test/Preprocessor/arm-target-features.c), but the predefine is controlled by the target feature "hwdiv" rather than "hwdiv-arm" -- which is why the problem went unnoticed for a long time...

Thanks a lot for your help Reid

More information about the cfe-commits mailing list