From cd34d5f2c40f3c65407f4b0bee0b49fc84e4a4ab Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 1 Dec 2020 18:59:18 -0800 Subject: compiler: defer to middle-end for complex division Go used to use slightly different semantics than C99 for complex division, so we used runtime routines to handle the different. The gc compiler has changes its behavior to match C99, so changes ours as well. For golang/go#14644 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/274213 --- gcc/go/gofrontend/MERGE | 2 +- gcc/go/gofrontend/expressions.cc | 21 --------------------- gcc/go/gofrontend/runtime.def | 6 ------ 3 files changed, 1 insertion(+), 28 deletions(-) (limited to 'gcc/go') diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 183e5ca..f55daf7 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -6b01f8cdc11d86bd98165c91d6ae101bcf6b9e1a +5364d15082de77d2759a01f254208d4cb4f579e3 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 23caf61..50574c2 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -6979,27 +6979,6 @@ Binary_expression::do_get_backend(Translate_context* context) // been converted to a String_concat_expression in do_lower. go_assert(!left_type->is_string_type()); - // For complex division Go might want slightly different results than the - // backend implementation provides, so we have our own runtime routine. - if (this->op_ == OPERATOR_DIV && this->left_->type()->complex_type() != NULL) - { - Runtime::Function complex_code; - switch (this->left_->type()->complex_type()->bits()) - { - case 64: - complex_code = Runtime::COMPLEX64_DIV; - break; - case 128: - complex_code = Runtime::COMPLEX128_DIV; - break; - default: - go_unreachable(); - } - Expression* complex_div = - Runtime::make_call(complex_code, loc, 2, this->left_, this->right_); - return complex_div->get_backend(context); - } - Bexpression* left = this->left_->get_backend(context); Bexpression* right = this->right_->get_backend(context); diff --git a/gcc/go/gofrontend/runtime.def b/gcc/go/gofrontend/runtime.def index 9a3c680..4b606a6 100644 --- a/gcc/go/gofrontend/runtime.def +++ b/gcc/go/gofrontend/runtime.def @@ -62,12 +62,6 @@ DEF_GO_RUNTIME(STRINGTOSLICERUNE, "runtime.stringtoslicerune", P2(POINTER, STRING), R1(SLICE)) -// Complex division. -DEF_GO_RUNTIME(COMPLEX64_DIV, "__go_complex64_div", - P2(COMPLEX64, COMPLEX64), R1(COMPLEX64)) -DEF_GO_RUNTIME(COMPLEX128_DIV, "__go_complex128_div", - P2(COMPLEX128, COMPLEX128), R1(COMPLEX128)) - // Make a slice. DEF_GO_RUNTIME(MAKESLICE, "runtime.makeslice", P3(TYPE, INT, INT), R1(POINTER)) -- cgit v1.1