From: Christian Borntraeger Subject: Re: [kvm-unit-tests PATCH v1 1/6] s390x: initial infrastructure Date: Tue, 16 May 2017 09:58:11 +0200 Message-ID: <8ad42ff1-5131-efd4-c39a-cd524df49e48@de.ibm.com> References: <20170512105830.10604-1-david@redhat.com> <20170512105830.10604-2-david@redhat.com> <42224dac-352b-a703-11ff-b3edfbcc581c@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit Cc: Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Thomas Huth , Cornelia Huck To: David Hildenbrand , kvm@vger.kernel.org Return-path: Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:54102 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751203AbdEPH6S (ORCPT ); Tue, 16 May 2017 03:58:18 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v4G7shsd147321 for ; Tue, 16 May 2017 03:58:17 -0400 Received: from e13.ny.us.ibm.com (e13.ny.us.ibm.com [129.33.205.203]) by mx0a-001b2d01.pphosted.com with ESMTP id 2afv7bbdpq-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 16 May 2017 03:58:17 -0400 Received: from localhost by e13.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 16 May 2017 03:58:16 -0400 In-Reply-To: <42224dac-352b-a703-11ff-b3edfbcc581c@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 05/16/2017 09:54 AM, David Hildenbrand wrote: > On 15.05.2017 11:19, Christian Borntraeger wrote: >> Nice to see somebody doing this for s390x. >> >> >> On 05/12/2017 12:58 PM, David Hildenbrand wrote: >> [...] >> >>> diff --git a/s390x/Makefile b/s390x/Makefile >>> new file mode 100644 >>> index 0000000..f9468bb >>> --- /dev/null >>> +++ b/s390x/Makefile >>> @@ -0,0 +1,32 @@ >>> +all: test_cases >>> + >>> +test_cases: $(tests) >>> + >>> +CFLAGS += -std=gnu99 >>> +CFLAGS += -ffreestanding >>> +CFLAGS += -Wextra >>> +CFLAGS += -I lib >>> +CFLAGS += -O2 >>> +CFLAGS += -msoft-float >> >> >> If you enable the AFP register control bit in your startup code, you can probably >> avoid the soft-float thing. >> > > Looks like we can drop that completely. > > a) no floating point operations are used either way. > > b) adding a very basic division results in > > static void test_fp(void) > { > double a, b; > > b = 6.5; > a = 2.0; > > b = b / a; > > report("test fp", b == 3.25); > } > > (compiled with -O0) > > s390x/selftest.o: In function `test_fp': > /home/dhildenb/git/kvm-unit-tests/s390x/selftest.c:21: undefined > reference to `__divdf3' > /home/dhildenb/git/kvm-unit-tests/s390x/selftest.c:23: undefined > reference to `__eqdf2' > > So we would need a soft float lib (as we're using -nostdlib) > > c) dropping -msoft-float > > A DDB (DIVIDE long BFP) is generated. That seems to work under TCG > without any exception. I assume the check for AFP-register control is > missing. I assume, that test would not pass under KVM. > > > For now I will simply drop -msoft-float. This will allow gcc to spill/fill into floating point registers, which are not all available without afp-register control. It will probably work because the gr->fpr move will not be used for -march=z900, but I suggest to not rely on that.