armv7: how to enable NEON/VFP with Clang-5.0.1 compiler

2018-05-03 Thread SASANO Takayoshi
Hello,

I am trying to build direwolf software-TNC(modem) to benchmark my pcDuino's
performance.

With my small patch, I got working binary. But it does not contains
VFP/NEON instruction with "-O3 -ffast-math -mfpu=neon" option.

To use VFP/NEON instruction, what option do I specify to armv7 clang?

(direwolf is at https://github.com/wb2osz/direwolf and patch for OpenBSD is
http://ik1-342-31132.vs.sakura.ne.jp/~uaa/gomitext/2018/20180503/20180503.diff )

Regards,
-- 
SASANO Takayoshi (JG1UAA) 



Re: armv7: how to enable NEON/VFP with Clang-5.0.1 compiler

2018-05-03 Thread Mark Kettenis
> Date: Thu, 03 May 2018 16:11:24 +0900
> From: SASANO Takayoshi 
> 
> Hello,
> 
> I am trying to build direwolf software-TNC(modem) to benchmark my pcDuino's
> performance.
> 
> With my small patch, I got working binary. But it does not contains
> VFP/NEON instruction with "-O3 -ffast-math -mfpu=neon" option.
> 
> To use VFP/NEON instruction, what option do I specify to armv7 clang?

You'll also need "-mfloat-abi=softfp".  Note that this is soon going
to be the default in -current.  At some point in the future we'll
switch the default to "-mfloat-abi=hardfp" which is inompatible with
"-mfloat-abi=softfp".  It is probably a bad idea to push changes that
explicitly set -mfloat-abi upstream.

> (direwolf is at https://github.com/wb2osz/direwolf and patch for OpenBSD is
> http://ik1-342-31132.vs.sakura.ne.jp/~uaa/gomitext/2018/20180503/20180503.diff
>  )



Re: armv7: how to enable NEON/VFP with Clang-5.0.1 compiler

2018-05-03 Thread SASANO Takayoshi
Hi,

>> To use VFP/NEON instruction, what option do I specify to armv7 clang?
> 
> You'll also need "-mfloat-abi=softfp".  Note that this is soon going
> to be the default in -current.  At some point in the future we'll
> switch the default to "-mfloat-abi=hardfp" which is inompatible with
> "-mfloat-abi=softfp".  It is probably a bad idea to push changes that
> explicitly set -mfloat-abi upstream.

Adding -mfloat-abi=softfp option solved the problem. Thanks.

I tried with that option before sending this question to ML
but the disassembled code of objdump-2.17 confused me.

1c44:   ed900a2afldss0, [r0, #168]
1c48:   e08f0001add r0, pc, r1
1c4c:   ed901a02fldss2, [r0, #8]
1c50:   eef80bc0cdp 11, 15, cr0, cr8, cr0, {6}
1c54:   eef81bc1cdp 11, 15, cr1, cr8, cr1, {6}
1c58:   eec10ba0cdp 11, 12, cr0, cr1, cr0, {5}

Same binary with objdump-2.27.

1c44:   ed900a2avldrs0, [r0, #168]  ; 0xa8
1c48:   e08f0001add r0, pc, r1
1c4c:   ed901a02vldrs2, [r0, #8]
1c50:   eef80bc0vcvt.f64.s32d16, s0
1c54:   eef81bc1vcvt.f64.s32d17, s2
1c58:   eec10ba0vdiv.f64d16, d17, d16

I thought the first letter of NEON/VFP instruction is "v",
so I misunderstood that these instruction is not available...

Best regards,
-- 
SASANO Takayoshi (JG1UAA) 



Re: gtk libool slow on arm

2018-05-03 Thread Artturi Alm
On Wed, May 02, 2018 at 05:36:33PM -0700, s_g...@telus.net wrote:
> Thank you for the advice.  I will try the patch, but I want to let the
> current php build complete, which may take a few more days.
> 
> Did you get the bme code I sent you?
> 

Yep, I just forgot about it, and now i did "over do" a bit with
the necessary cleanup/refactoring.. oops, but no more ugly unions nor
"forbidden hacks":)

diff below does still miss a few things like BUGS from the man page,
as i consider current hardcoded configuration, while useful for
most cases, as a bug that should be fixed before ie. spi, HZ=1000, etc..

It could be used for even indoor navigation, so I think the sensor has
plenty more potential, than what bme(4) does now offer, but i don't
see why you couldn't offer it as-is, if you find it working after
properly testing this version, on tech@, good luck:)

-Artturi


diff --git share/man/man4/Makefile share/man/man4/Makefile
index 8004d8b575d..3ac02b89788 100644
--- share/man/man4/Makefile
+++ share/man/man4/Makefile
@@ -15,7 +15,7 @@ MAN=  aac.4 ac97.4 acphy.4 acrtc.4 \
auacer.4 audio.4 aue.4 auglx.4 auich.4 auixp.4 autri.4 auvia.4 \
axe.4 axen.4 axppmic.4 azalia.4 \
bce.4 bcmaux.4 bcmdog.4  bcmrng.4 bcmtemp.4 berkwdt.4 bge.4 \
-   bgw.4 bio.4 bktr.4 bmtphy.4 bnx.4 \
+   bgw.4 bio.4 bktr.4 bme.4 bmtphy.4 bnx.4 \
boca.4 bpf.4 brgphy.4 bridge.4 brswphy.4 bwfm.4 bwi.4 bytgpio.4 \
cac.4 cas.4 cardbus.4 carp.4 ccp.4 cd.4 cdce.4 cfxga.4 \
ch.4 chvgpio.4 ciphy.4 ciss.4 clcs.4 clct.4 cmpci.4 \
diff --git share/man/man4/bme.4 share/man/man4/bme.4
new file mode 100644
index 000..bb48513d9dc
--- /dev/null
+++ share/man/man4/bme.4
@@ -0,0 +1,44 @@
+.\"$OpenBSD: tsl.4,v 1.10 2015/10/02 09:29:02 sobrado Exp $
+.\"
+.\" Copyright (c) 2005 Mark Kettenis 
+.\" Copyright (c) 2018 Artturi Alm
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.Dd $Mdocdate$
+.Dt BME 4
+.Os
+.Sh NAME
+.Nm bme
+.Nd Bosch BME280 Environmental sensor
+.Sh SYNOPSIS
+.Cd "bme* at iic?"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the Bosch BME280 Environmental sensor.
+These sensors contain combined digital humidity, pressure and temperature
+sensing capabilities.
+These values are made available through the
+.Xr sysctl 8
+interface.
+.Sh SEE ALSO
+.Xr iic 4 ,
+.Xr intro 4 ,
+.Xr sensorsd 8 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Ox 6.4 .
diff --git sys/arch/arm64/conf/GENERIC sys/arch/arm64/conf/GENERIC
index d7b7dca12bf..37050606674 100644
--- sys/arch/arm64/conf/GENERIC
+++ sys/arch/arm64/conf/GENERIC
@@ -296,6 +296,7 @@ ch* at scsibus?
 uk*at scsibus?
 
 # I2C devices
+bme*   at iic? # BME280 environmental sensor
 islrtc*at iic? # ISL1208 RTC
 rkpmic*at iic? # RK808 PMIC
 
diff --git sys/arch/armv7/conf/GENERIC sys/arch/armv7/conf/GENERIC
index 052f73bf71f..fae08d5c8cd 100644
--- sys/arch/armv7/conf/GENERIC
+++ sys/arch/armv7/conf/GENERIC
@@ -178,7 +178,9 @@ iic*at rkiic?
 rktemp*at fdt?
 dwdog* at fdt?
 
+# I2C devices
 axppmic*   at iic? # axp209 pmic
+bme*   at iic? # BME280 environmental sensor
 crosec*at iic?
 wskbd* at crosec? mux 1
 pcfrtc*at iic?
diff --git sys/dev/fdt/bme.c sys/dev/fdt/bme.c
new file mode 100644
index 000..04a61dc7d19
--- /dev/null
+++ sys/dev/fdt/bme.c
@@ -0,0 +1,547 @@
+/* $OpenBSD: tsl2560.c,v 1.7 2008/04/18 01:17:51 deraadt Exp $ */
+
+/*
+ * Copyright (c) 2005 Mark Kettenis
+ * Copyright (c) 2017 Artturi Alm
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR

Re: gtk libool slow on arm

2018-05-03 Thread s_graf
Thank you for the updates.  I will build and test as soon as I get finished 
with the php build.  My system is still flailing away at gtk with each ld 
session taking about 20 minutes.  Could be days yet.

-Original Message-
From: owner-...@openbsd.org  On Behalf Of Artturi Alm
Sent: May 3, 2018 5:21 PM
To: Stephen Graf 
Cc: arm@openbsd.org
Subject: Re: gtk libool slow on arm

On Wed, May 02, 2018 at 05:36:33PM -0700, s_g...@telus.net wrote:
> Thank you for the advice.  I will try the patch, but I want to let the 
> current php build complete, which may take a few more days.
> 
> Did you get the bme code I sent you?
> 

Yep, I just forgot about it, and now i did "over do" a bit with the necessary 
cleanup/refactoring.. oops, but no more ugly unions nor "forbidden hacks":)

diff below does still miss a few things like BUGS from the man page, as i 
consider current hardcoded configuration, while useful for most cases, as a bug 
that should be fixed before ie. spi, HZ=1000, etc..

It could be used for even indoor navigation, so I think the sensor has plenty 
more potential, than what bme(4) does now offer, but i don't see why you 
couldn't offer it as-is, if you find it working after properly testing this 
version, on tech@, good luck:)

-Artturi


diff --git share/man/man4/Makefile share/man/man4/Makefile index 
8004d8b575d..3ac02b89788 100644
--- share/man/man4/Makefile
+++ share/man/man4/Makefile
@@ -15,7 +15,7 @@ MAN=  aac.4 ac97.4 acphy.4 acrtc.4 \
auacer.4 audio.4 aue.4 auglx.4 auich.4 auixp.4 autri.4 auvia.4 \
axe.4 axen.4 axppmic.4 azalia.4 \
bce.4 bcmaux.4 bcmdog.4  bcmrng.4 bcmtemp.4 berkwdt.4 bge.4 \
-   bgw.4 bio.4 bktr.4 bmtphy.4 bnx.4 \
+   bgw.4 bio.4 bktr.4 bme.4 bmtphy.4 bnx.4 \
boca.4 bpf.4 brgphy.4 bridge.4 brswphy.4 bwfm.4 bwi.4 bytgpio.4 \
cac.4 cas.4 cardbus.4 carp.4 ccp.4 cd.4 cdce.4 cfxga.4 \
ch.4 chvgpio.4 ciphy.4 ciss.4 clcs.4 clct.4 cmpci.4 \ diff --git 
share/man/man4/bme.4 share/man/man4/bme.4 new file mode 100644 index 
000..bb48513d9dc
--- /dev/null
+++ share/man/man4/bme.4
@@ -0,0 +1,44 @@
+.\"$OpenBSD: tsl.4,v 1.10 2015/10/02 09:29:02 sobrado Exp $
+.\"
+.\" Copyright (c) 2005 Mark Kettenis  .\" 
+Copyright (c) 2018 Artturi Alm .\"
+.\" Permission to use, copy, modify, and distribute this software for 
+any .\" purpose with or without fee is hereby granted, provided that 
+the above .\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 
+WARRANTIES .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 
+WARRANTIES OF .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 
+AUTHOR BE LIABLE FOR .\" ANY SPECIAL, DIRECT, INDIRECT, OR 
+CONSEQUENTIAL DAMAGES OR ANY DAMAGES .\" WHATSOEVER RESULTING FROM LOSS 
+OF USE, DATA OR PROFITS, WHETHER IN AN .\" ACTION OF CONTRACT, 
+NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH 
THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.Dd $Mdocdate$
+.Dt BME 4
+.Os
+.Sh NAME
+.Nm bme
+.Nd Bosch BME280 Environmental sensor
+.Sh SYNOPSIS
+.Cd "bme* at iic?"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the Bosch BME280 Environmental sensor.
+These sensors contain combined digital humidity, pressure and 
+temperature sensing capabilities.
+These values are made available through the .Xr sysctl 8 interface.
+.Sh SEE ALSO
+.Xr iic 4 ,
+.Xr intro 4 ,
+.Xr sensorsd 8 ,
+.Xr sysctl 8
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Ox 6.4 .
diff --git sys/arch/arm64/conf/GENERIC sys/arch/arm64/conf/GENERIC index 
d7b7dca12bf..37050606674 100644
--- sys/arch/arm64/conf/GENERIC
+++ sys/arch/arm64/conf/GENERIC
@@ -296,6 +296,7 @@ ch* at scsibus?
 uk*at scsibus?
 
 # I2C devices
+bme*   at iic? # BME280 environmental sensor
 islrtc*at iic? # ISL1208 RTC
 rkpmic*at iic? # RK808 PMIC
 
diff --git sys/arch/armv7/conf/GENERIC sys/arch/armv7/conf/GENERIC index 
052f73bf71f..fae08d5c8cd 100644
--- sys/arch/armv7/conf/GENERIC
+++ sys/arch/armv7/conf/GENERIC
@@ -178,7 +178,9 @@ iic*at rkiic?
 rktemp*at fdt?
 dwdog* at fdt?
 
+# I2C devices
 axppmic*   at iic? # axp209 pmic
+bme*   at iic? # BME280 environmental sensor
 crosec*at iic?
 wskbd* at crosec? mux 1
 pcfrtc*at iic?
diff --git sys/dev/fdt/bme.c sys/dev/fdt/bme.c new file mode 100644 index 
000..04a61dc7d19
--- /dev/null
+++ sys/dev/fdt/bme.c
@@ -0,0 +1,547 @@
+/* $OpenBSD: tsl2560.c,v 1.7 2008/04/18 01:17:51 deraadt Exp $ */
+
+/*
+ * Copyright (c) 2005 Mark Kettenis
+ * Copyright (c) 2017 Artturi Alm
+ *
+ * Permission to use, copy, modify, and distribute this software for 
+any
+ * purpose with or without fee is hereby granted, provided that the 
+above
+ * copy