x86/svm: Improve code generation from cpu_has_svm_feature()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 12 Feb 2019 18:33:30 +0000 (18:33 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 15 Mar 2019 17:53:25 +0000 (17:53 +0000)
commit1e780ef5a527661d1d6106ccacf65706e3ed664d
tree83ac424d1d60f67175e5bbdc595ee70ae6cf09a0
parent356f437171c5bb90701ac9dd7ba4dbbd05988e38
x86/svm: Improve code generation from cpu_has_svm_feature()

Taking svm_feature_flags by pointer and using test_bit() results in generated
code which loads svm_feature_flags into a 32bit register, then does a bitwise
operation.

The logic can be expressed in terms of a straight bitwise operation, resulting
in the following minor improvement.

  add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-136 (-136)
  Function                                     old     new   delta
  svm_nested_features_on_efer_update           281     273      -8
  svm_create_vmcb                             1404    1388     -16
  svm_vmexit_handler                          6271    6239     -32
  start_svm                                    818     738     -80
  Total: Before=3347569, After=3347433, chg -0.00%

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
xen/include/asm-x86/hvm/svm/svm.h